use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class PostParamTest method findPostOperationWithSingleObject.
@Test(description = "find a Post operation with single object")
public void findPostOperationWithSingleObject() {
Path petPath = getPath("singleObject");
assertNotNull(petPath);
assertNull(petPath.getGet());
Operation petPost = petPath.getPost();
assertNotNull(petPost);
assertEquals(petPost.getParameters().size(), 1);
BodyParameter petPostBodyParam = (BodyParameter) petPost.getParameters().get(0);
assertEquals(petPostBodyParam.getName(), BODY);
assertTrue(petPostBodyParam.getSchema() instanceof Model);
assertEquals(swagger.getDefinitions().get(PET).getProperties().get("status").getAccess(), "public");
}
use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class ChildTypeTest method testChildTypeResponseOnOperation.
@Test(description = "Tests child type response schema ref is correctly set up when specified on the operation")
public void testChildTypeResponseOnOperation() {
Operation op = swagger.getPath("/childType/testChildTypeResponseOnOperation").getGet();
Property schema = op.getResponses().get("200").getSchema();
assertEquals(schema.getClass().getName(), RefProperty.class.getName());
assertEquals(((RefProperty) schema).getSimpleRef(), "Sub1Bean");
}
use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class ChildTypeTest method testChildTypeParameter.
@Test(description = "Tests schema ref is correctly set up for child type parameter")
public void testChildTypeParameter() {
Operation op = swagger.getPath("/childType/testChildTypeParameter").getPost();
BodyParameter parameter = getBodyParameter(op, 0);
Model schema = parameter.getSchema();
assertEquals(schema.getClass().getName(), RefModel.class.getName());
assertEquals(((RefModel) schema).getSimpleRef(), "Sub1Bean");
}
use of io.swagger.models.Operation in project swagger-core by swagger-api.
the class CollectionFormatTest method readFormParamTest.
@Test(testName = "check collection format for FormParam")
public void readFormParamTest() {
Operation operation = getOperation("testFormParam");
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 readMixedParamTest.
@Test(testName = "check collection format for Mixed Param")
public void readMixedParamTest() {
Operation operation = getOperation("testMixedParam");
assertEquals(getCollectionFormat(operation, 0), MULTI);
assertEquals(getCollectionFormat(operation, 1), CSV);
assertNull(getCollectionFormat(operation, 2));
assertEquals(getCollectionFormat(operation, 3), CSV);
}
Aggregations