use of org.apache.servicecomb.swagger.generator.core.OperationGenerator in project incubator-servicecomb-java-chassis by apache.
the class ApiOperationProcessorTest method testConvertTags.
@Test
public void testConvertTags() throws NoSuchMethodException {
ApiOperationProcessor apiOperationProcessor = new ApiOperationProcessor();
Method function = TestClass.class.getMethod("function");
SwaggerGenerator swaggerGenerator = new SwaggerGenerator(new PojoSwaggerGeneratorContext(), TestClass.class);
OperationGenerator operationGenerator = new OperationGenerator(swaggerGenerator, function);
apiOperationProcessor.process(function.getAnnotation(ApiOperation.class), operationGenerator);
assertThat(operationGenerator.getOperation().getTags(), containsInAnyOrder("tag1", "tag2"));
}
use of org.apache.servicecomb.swagger.generator.core.OperationGenerator in project incubator-servicecomb-java-chassis by apache.
the class ApiOperationProcessorTest method testConvertTagsOnMethodWithNoTag.
@Test
public void testConvertTagsOnMethodWithNoTag() throws NoSuchMethodException {
ApiOperationProcessor apiOperationProcessor = new ApiOperationProcessor();
Method function = TestClass.class.getMethod("functionWithNoTag");
SwaggerGenerator swaggerGenerator = new SwaggerGenerator(new PojoSwaggerGeneratorContext(), TestClass.class);
OperationGenerator operationGenerator = new OperationGenerator(swaggerGenerator, function);
apiOperationProcessor.process(function.getAnnotation(ApiOperation.class), operationGenerator);
List<String> tagList = operationGenerator.getOperation().getTags();
assertNull(tagList);
}
Aggregations