Java 类io.swagger.annotations.Tag 实例源码

项目:incubator-servicecomb-java-chassis    文件:SwaggerDefinitionProcessorTest.java   
@Test
public void testProcess() {
  SwaggerGenerator swaggerGenerator = new SwaggerGenerator(Mockito.mock(SwaggerGeneratorContext.class),
      null);
  swaggerDefinitionProcessor.process(SwaggerTestTarget.class.getAnnotation(SwaggerDefinition.class),
      swaggerGenerator);

  Swagger swagger = swaggerGenerator.getSwagger();
  assertEquals(1, swagger.getTags().size());
  io.swagger.models.Tag tag = swagger.getTags().get(0);
  assertEquals("testTag", tag.getName());
  assertEquals("desc", tag.getDescription());
  assertEquals("testValue", tag.getExternalDocs().getDescription());
  assertEquals("testUrl", tag.getExternalDocs().getUrl());
  assertEquals("127.0.0.1", swagger.getHost());
  assertThat(swagger.getSchemes(), contains(io.swagger.models.Scheme.HTTP, io.swagger.models.Scheme.HTTPS));
  io.swagger.models.Info info = swagger.getInfo();
  assertEquals("title", info.getTitle());
  assertEquals("version", info.getVersion());
  assertEquals("desc", info.getDescription());
  assertEquals("contactName", info.getContact().getName());
  assertEquals("licenseName", info.getLicense().getName());
}