test_class.declarator: app
test_class.modifier: private
test_class.original_string: private Application app;
test_class.type: Application
test_class.var_name: app
test_class.declarator: sc
test_class.modifier: private
test_class.original_string: private ServletConfig sc;
test_class.type: ServletConfig
test_class.var_name: sc
test_class.file: dubbo-rpc/dubbo-rpc-rest/src/test/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerApiListingResourceTest.java
test_class.identifier: DubboSwaggerApiListingResourceTest
test_case.body: @Test
      public void test() throws Exception {
  
          DubboSwaggerApiListingResource resource = new  DubboSwaggerApiListingResource();
  
          app = mock(Application.class);
          sc = mock(ServletConfig.class);
          Set<Class<?>> sets = new HashSet<Class<?>>();
          sets.add(SwaggerService.class);
  
          when(sc.getServletContext()).thenReturn(mock(ServletContext.class));
          when(app.getClasses()).thenReturn(sets);
  
          Response response = resource.getListingJson(app, sc,
                  null, new ResteasyUriInfo(new URI("http://rest.test")));
  
          Assertions.assertNotNull(response);
          Swagger swagger = (Swagger)response.getEntity();
          Assertions.assertEquals("SwaggerService",swagger.getTags().get(0).getName());
          Assertions.assertEquals("/demoService/hello",swagger.getPaths().keySet().toArray()[0].toString());
      }
test_case.class_method_signature: DubboSwaggerApiListingResourceTest.test()
test_case.full_signature: @Test public void test()
test_case.identifier: test
test_case.invocations: mock mock add thenReturn when getServletContext mock thenReturn when getClasses getListingJson assertNotNull getEntity assertEquals getName get getTags assertEquals toString toArray keySet getPaths
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test()
focal_class.declarator: context
focal_class.modifier: @Context
focal_class.original_string: @Context
      ServletContext context;
focal_class.type: ServletContext
focal_class.var_name: context
focal_class.file: dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/integration/swagger/DubboSwaggerApiListingResource.java
focal_class.identifier: DubboSwaggerApiListingResource
focal_class.interfaces: implements DubboSwaggerService
focal_class.class_method_signature: DubboSwaggerApiListingResource.getListingJson(Application app, ServletConfig sc,
                                     HttpHeaders headers, UriInfo uriInfo)
focal_class.full_signature: @Override public Response getListingJson(Application app, ServletConfig sc,
                                     HttpHeaders headers, UriInfo uriInfo)
focal_class.identifier: getListingJson
focal_class.modifiers: @Override public
focal_class.parameters: (Application app, ServletConfig sc,
                                     HttpHeaders headers, UriInfo uriInfo)
focal_class.return: Response
focal_class.signature: Response getListingJson(Application app, ServletConfig sc,
                                     HttpHeaders headers, UriInfo uriInfo)
focal_class.superclass: extends BaseApiListingResource
focal_method.body: @Override
      public Response getListingJson(Application app, ServletConfig sc,
                                     HttpHeaders headers, UriInfo uriInfo)  throws JsonProcessingException {
          Response response =  getListingJsonResponse(app, context, sc, headers, uriInfo);
          response.getHeaders().add("Access-Control-Allow-Origin", "*");
          response.getHeaders().add("Access-Control-Allow-Headers", "x-requested-with, ssi-token");
          response.getHeaders().add("Access-Control-Max-Age", "3600");
          response.getHeaders().add("Access-Control-Allow-Methods","GET,POST,PUT,DELETE,OPTIONS");
          return response;
      }
focal_method.class_method_signature: DubboSwaggerApiListingResource.getListingJson(Application app, ServletConfig sc,
                                     HttpHeaders headers, UriInfo uriInfo)
focal_method.full_signature: @Override public Response getListingJson(Application app, ServletConfig sc,
                                     HttpHeaders headers, UriInfo uriInfo)
focal_method.identifier: getListingJson
focal_method.invocations: getListingJsonResponse add getHeaders add getHeaders add getHeaders add getHeaders
focal_method.modifiers: @Override public
focal_method.parameters: (Application app, ServletConfig sc,
                                     HttpHeaders headers, UriInfo uriInfo)
focal_method.return: Response
focal_method.signature: Response getListingJson(Application app, ServletConfig sc,
                                     HttpHeaders headers, UriInfo uriInfo)