use of io.swagger.models.Swagger in project swagger-core by swagger-api.
the class SubResourceReaderTest method findBodyParam.
@Test(description = "find a body param")
public void findBodyParam() {
Swagger swagger = getSwagger(Resource942.class);
assertTrue(swagger.getPath("/test").getPost().getParameters().get(0) instanceof BodyParameter);
}
use of io.swagger.models.Swagger in project swagger-core by swagger-api.
the class SubResourceReaderTest method readResourceWithClassBasedSubresources.
@Test(description = "scan resource with class-based sub-resources")
public void readResourceWithClassBasedSubresources() {
final Swagger swagger = getSwagger(SubResourceHead.class);
assertEquals(swagger.getPaths().size(), 3);
assertEquals(getOperationId(swagger, "/head/noPath"), "getGreeting");
assertEquals(getOperationId(swagger, "/head/tail/hello"), "getGreeting");
final Operation echo = getGet(swagger, "/head/tail/{string}");
assertEquals(echo.getOperationId(), "getEcho");
assertEquals(echo.getParameters().size(), 1);
}
use of io.swagger.models.Swagger in project swagger-core by swagger-api.
the class SubResourceReaderTest method readResourceWithSubresources.
@Test(description = "scan a resource with subresources")
public void readResourceWithSubresources() {
final Swagger swagger = getSwagger(ResourceWithSubResources.class);
assertEquals(getOperationId(swagger, "/employees/{id}"), "getAllEmployees");
assertEquals(getOperationId(swagger, "/employees/{id}/{id}"), "getSubresourceOperation");
assertEquals(getOperationId(swagger, "/employees/noPath"), "getGreeting");
}
use of io.swagger.models.Swagger in project swagger-core by swagger-api.
the class SwaggerConfigLocatorTest method putConfigFirstTime.
@Test(description = "should add given config to map ")
public void putConfigFirstTime() {
SwaggerConfig config = new SwaggerConfig() {
@Override
public Swagger configure(Swagger swagger) {
return swagger;
}
@Override
public String getFilterClass() {
return null;
}
};
SwaggerConfigLocator.getInstance().putConfig(id, config);
assertEquals(SwaggerConfigLocator.getInstance().getConfig(id), config);
}
use of io.swagger.models.Swagger in project swagger-core by swagger-api.
the class SwaggerConfigLocatorTest method putConfigSecondTime.
@Test(description = "shouldn't add given config to map because already set")
public void putConfigSecondTime() {
putConfigFirstTime();
SwaggerConfig config = new SwaggerConfig() {
@Override
public Swagger configure(Swagger swagger) {
return swagger;
}
@Override
public String getFilterClass() {
return null;
}
};
SwaggerConfigLocator.getInstance().putConfig(id, config);
assertNotEquals(SwaggerConfigLocator.getInstance().getConfig(id), config);
}
Aggregations