@Test public void shouldGetCategory() { final Response response = target(CATEGORY_ID).request().get(); assertEquals(OK_200, response.getStatus()); Mockito.verify(categoryService).findNotHiddenById(CATEGORY_ID); Mockito.verify(apiService).findPublishedByUser(USER_NAME); Mockito.verify(categoryService).getTotalApisByCategory(any(), any()); Mockito.verify(categoryMapper).convert(any(), any()); final Category responseCategory = response.readEntity(Category.class); assertNotNull(responseCategory); }
@GET @Produces(APPLICATION_JSON) public Response get(@PathParam("categoryId") String categoryId) { CategoryEntity category = categoryService.findNotHiddenById(categoryId); Set<ApiEntity> apis = apiService.findPublishedByUser(getAuthenticatedUserOrNull()); category.setTotalApis(categoryService.getTotalApisByCategory(apis, category)); return Response .ok(categoryMapper.convert(category, uriInfo.getBaseUriBuilder())) .build(); }
CategoryResource extends AbstractResource { @GET @Produces(APPLICATION_JSON) public Response get(@PathParam("categoryId") String categoryId) { CategoryEntity category = categoryService.findNotHiddenById(categoryId); Set<ApiEntity> apis = apiService.findPublishedByUser(getAuthenticatedUserOrNull()); category.setTotalApis(categoryService.getTotalApisByCategory(apis, category)); return Response .ok(categoryMapper.convert(category, uriInfo.getBaseUriBuilder())) .build(); } }
CategoryResource extends AbstractResource { @GET @Produces(APPLICATION_JSON) public Response get(@PathParam("categoryId") String categoryId) { CategoryEntity category = categoryService.findNotHiddenById(categoryId); Set<ApiEntity> apis = apiService.findPublishedByUser(getAuthenticatedUserOrNull()); category.setTotalApis(categoryService.getTotalApisByCategory(apis, category)); return Response .ok(categoryMapper.convert(category, uriInfo.getBaseUriBuilder())) .build(); }  }
CategoryResource extends AbstractResource { @GET @Produces(APPLICATION_JSON) public Response get(@PathParam("categoryId") String categoryId) { CategoryEntity category = categoryService.findNotHiddenById(categoryId); Set<ApiEntity> apis = apiService.findPublishedByUser(getAuthenticatedUserOrNull()); category.setTotalApis(categoryService.getTotalApisByCategory(apis, category)); return Response .ok(categoryMapper.convert(category, uriInfo.getBaseUriBuilder())) .build(); }  @GET @Produces(APPLICATION_JSON) Response get(@PathParam("categoryId") String categoryId); @GET @Path("picture") Response picture(@Context Request request, @PathParam("categoryId") String categoryId); @GET @Path("background") Response background(@Context Request request, @PathParam("categoryId") String categoryId); }
CategoryResource extends AbstractResource { @GET @Produces(APPLICATION_JSON) public Response get(@PathParam("categoryId") String categoryId) { CategoryEntity category = categoryService.findNotHiddenById(categoryId); Set<ApiEntity> apis = apiService.findPublishedByUser(getAuthenticatedUserOrNull()); category.setTotalApis(categoryService.getTotalApisByCategory(apis, category)); return Response .ok(categoryMapper.convert(category, uriInfo.getBaseUriBuilder())) .build(); }  @GET @Produces(APPLICATION_JSON) Response get(@PathParam("categoryId") String categoryId); @GET @Path("picture") Response picture(@Context Request request, @PathParam("categoryId") String categoryId); @GET @Path("background") Response background(@Context Request request, @PathParam("categoryId") String categoryId);  }