use of io.swagger.servlet.ReaderContext in project swagger-core by swagger-api.
the class PathGetterTest method getPathTest.
@Test(dataProvider = "resourceWithAnnotations")
public void getPathTest(String methodName, String expected) throws NoSuchMethodException {
final ReaderContext context = createDefaultContext();
context.setParentPath("/tests");
Assert.assertEquals(extension.getPath(context, findMethod(context, methodName)), expected);
}
use of io.swagger.servlet.ReaderContext in project swagger-core by swagger-api.
the class ResponsesTest method applyResponsesTest.
@Test(dataProvider = "resourceWithAnnotations")
public void applyResponsesTest(String methodName, Response expected) throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContext();
extension.applyResponses(context, operation, findMethod(context, methodName));
if (expected == null) {
Assert.assertNull(operation.getResponses());
} else {
final Response response = operation.getResponses().get("200");
Assert.assertEquals(response.getDescription(), expected.getDescription());
}
}
use of io.swagger.servlet.ReaderContext in project swagger-core by swagger-api.
the class ResponsesTest method detailedResponsesTest.
@Test
public void detailedResponsesTest() throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContext();
extension.applyResponses(context, operation, findMethod(context, "testMethod3"));
final Map<String, Response> responses = operation.getResponses();
Assert.assertEquals(responses.size(), 7);
for (Map.Entry<String, String> entry : ResponsesTest.responses.entrySet()) {
Assert.assertEquals(responses.get(entry.getKey()).getDescription(), entry.getValue());
}
}
use of io.swagger.servlet.ReaderContext in project swagger-core by swagger-api.
the class SchemesTest method applySchemesTest.
@Test(dataProvider = "resourceWithAnnotations")
public void applySchemesTest(String methodName, List<Scheme> expected) throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContext();
extension.applySchemes(context, operation, findMethod(context, methodName));
Assert.assertEquals(operation.getSchemes(), expected);
}
use of io.swagger.servlet.ReaderContext in project swagger-core by swagger-api.
the class SecurityRequirementsTest method securityRequirementsTest1.
@Test(dataProvider = "resourceWithAnnotations")
public void securityRequirementsTest1(String methodName, SecurityRequirement expected) throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContext();
extension.applySecurityRequirements(context, operation, findMethod(context, methodName));
Assert.assertEquals(operation.getSecurity().get(0), expected.getRequirements());
}
Aggregations