use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class CollectionFormatTest method readPathParamTest.
@Test(testName = "check collection format for PathParam")
public void readPathParamTest() {
Operation operation = getOperation("testPathParam");
assertEquals(getCollectionFormat(operation, 0), CSV);
assertNull(getCollectionFormat(operation, 1));
assertEquals(getCollectionFormat(operation, 2), CSV);
}
use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class CollectionFormatTest method readQueryParamTest.
@Test(testName = "check collection format for QueryParam")
public void readQueryParamTest() {
Operation operation = getOperation("testQueryParam");
assertEquals(getCollectionFormat(operation, 0), MULTI);
assertNull(getCollectionFormat(operation, 1));
assertEquals(getCollectionFormat(operation, 2), MULTI);
}
use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class CollectionFormatTest method readHeaderParamTest.
@Test(testName = "check collection format for HeaderParam")
public void readHeaderParamTest() {
Operation operation = getOperation("testHeaderParam");
assertEquals(getCollectionFormat(operation, 0), CSV);
assertNull(getCollectionFormat(operation, 1));
assertEquals(getCollectionFormat(operation, 2), CSV);
}
use of io.swagger.models.Operation 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.models.Operation 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());
}
Aggregations