[ 
https://issues.apache.org/jira/browse/SCB-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16315759#comment-16315759
 ] 

ASF GitHub Bot commented on SCB-195:
------------------------------------

WillemJiang commented on a change in pull request #493: [SCB-195] Support 
swagger @Api annotation to specify default tags
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/493#discussion_r160082493
 
 

 ##########
 File path: 
swagger/swagger-generator/generator-core/src/test/java/io/servicecomb/swagger/generator/core/processor/annotation/ApiOperationProcessorTest.java
 ##########
 @@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.servicecomb.swagger.generator.core.processor.annotation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.junit.Test;
+
+import io.servicecomb.swagger.generator.core.OperationGenerator;
+import io.servicecomb.swagger.generator.core.SwaggerGenerator;
+import io.servicecomb.swagger.generator.pojo.PojoSwaggerGeneratorContext;
+import io.swagger.annotations.ApiOperation;
+
+public class ApiOperationProcessorTest {
+
+  @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);
+
+    List<String> tagList = operationGenerator.getOperation().getTags();
+    assertEquals(2, tagList.size());
 
 Review comment:
   You can use org.hamcrest.Matcher.containsInAnyOrder() to check the Tags just 
like this.
   
   assertThat(operationGenerator.getOperation().getTags(), 
containsInAnyOrder("tag1", "tag2"));

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Improve support to Swagger tag
> ------------------------------
>
>                 Key: SCB-195
>                 URL: https://issues.apache.org/jira/browse/SCB-195
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Java-Chassis
>            Reporter: YaoHaishi
>            Assignee: YaoHaishi
>             Fix For: java-chassis-1.0.0-m1
>
>         Attachments: the empty string marked as error.png
>
>
> As a user, I want to use io.swagger.annotations.Api annotation to set default 
> tags to operations.
> At present, ServiceComb doesn't support `@Api` annotation, we need to provide 
> a processor to handle this annotation.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to