use of io.swagger.servlet.ReaderContext in project swagger-core by swagger-api.
the class TagsTest method applyTagsTest2.
@Test(dataProvider = "resourceWithoutApiAnnotation")
public void applyTagsTest2(String methodName, List<String> expected) throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContextWithoutApi();
extension.applyTags(context, operation, findMethod(context, methodName));
Assert.assertEquals(operation.getTags(), expected);
}
use of io.swagger.servlet.ReaderContext in project swagger-core by swagger-api.
the class ConsumesProducesTest method applyConsumesProducesTest2.
@Test(dataProvider = "resourceWithoutApiAnnotation")
public void applyConsumesProducesTest2(String methodName, List<String> expected) throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContextWithoutApi();
final Method method = findMethod(context, methodName);
extension.applyConsumes(context, operation, method);
extension.applyProduces(context, operation, method);
Assert.assertEquals(operation.getConsumes(), expected);
Assert.assertEquals(operation.getProduces(), expected);
}
use of io.swagger.servlet.ReaderContext in project swagger-core by swagger-api.
the class ImplicitParametersTest method detailedTest.
@Test
public void detailedTest() throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContext();
extension.applyImplicitParameters(context, operation, findMethod(context, "testMethod3"));
final List<Parameter> parameters = operation.getParameters();
final Parameter parameter1 = parameters.get(0);
Assert.assertNotNull(parameter1);
Assert.assertTrue(parameter1 instanceof PathParameter);
Assert.assertEquals(parameter1.getName(), "param1");
Assert.assertEquals(parameter1.getIn(), "path");
Assert.assertEquals(parameter1.getDescription(), "Param 1");
Assert.assertTrue(parameter1.getRequired());
final Parameter parameter5 = parameters.get(4);
Assert.assertNotNull(parameter5);
Assert.assertTrue(parameter5 instanceof BodyParameter);
Assert.assertEquals(parameter5.getName(), "param5");
Assert.assertEquals(parameter5.getIn(), "body");
Assert.assertEquals(parameter5.getDescription(), "Param 5");
Assert.assertFalse(parameter5.getRequired());
}
use of io.swagger.servlet.ReaderContext in project swagger-core by swagger-api.
the class SchemesTest method applySchemesWithoutApiTest.
@Test(dataProvider = "resourceWithoutApiAnnotation")
public void applySchemesWithoutApiTest(String methodName, List<Scheme> expected) throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContextWithoutApi();
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 securityRequirementsTest2.
@Test(dataProvider = "resourceWithoutApiAnnotation")
public void securityRequirementsTest2(String methodName, SecurityRequirement expected) throws NoSuchMethodException {
final Operation operation = new Operation();
final ReaderContext context = createDefaultContextWithoutApi();
extension.applySecurityRequirements(context, operation, findMethod(context, methodName));
if (expected == null) {
Assert.assertNull(operation.getSecurity());
} else {
Assert.assertEquals(operation.getSecurity().get(0), expected.getRequirements());
}
}
Aggregations