@Test public void getFrameworkResources() { Resource mockedResource1 = new Resource(); mockedResource1.setId("resource-1"); mockedResource1.setName("resource-1"); mockedResource1.setLabel("Resource 1"); mockedResource1.setFramework("test-framework"); mockedResource1.setFrameworkLabel("Test Framework"); Resource mockedResource2 = new Resource(); mockedResource2.setId("resource-2"); mockedResource2.setName("resource-2"); mockedResource2.setLabel("Resource 2"); mockedResource2.setFramework("test-framework"); mockedResource2.setFrameworkLabel("Test Framework"); List<Resource> mockedResources = new ArrayList<Resource>(); mockedResources.add(mockedResource1); mockedResources.add(mockedResource2); when(resourceServiceMock.listResourcesWithFramework(anyString())) .thenReturn(mockedResources); List<Resource> responseResources = resource().path("/api/frameworks/" + mockedResource1.getFramework() + "/resources").accept(MediaType.APPLICATION_JSON) .get(new GenericType<List<Resource>>(){}); assertEquals("Response resources should match the mocked resources", mockedResources, responseResources); verify(resourceServiceMock).listResourcesWithFramework(anyString()); }
@GET @Path("/{frameworkId}/resources") @Produces(MediaType.APPLICATION_JSON) public List<Resource> getFrameworkResources(@PathParam("frameworkId") String frameworkId) { return resourceService.listResourcesWithFramework(frameworkId); }
FrameworkResource { @GET @Path("/{frameworkId}/resources") @Produces(MediaType.APPLICATION_JSON) public List<Resource> getFrameworkResources(@PathParam("frameworkId") String frameworkId) { return resourceService.listResourcesWithFramework(frameworkId); } }
FrameworkResource { @GET @Path("/{frameworkId}/resources") @Produces(MediaType.APPLICATION_JSON) public List<Resource> getFrameworkResources(@PathParam("frameworkId") String frameworkId) { return resourceService.listResourcesWithFramework(frameworkId); } @Inject  FrameworkResource(FrameworkService frameworkService,
            ComponentService componentService, ResourceService resourceService,
            SerializationService serializationService); }
FrameworkResource { @GET @Path("/{frameworkId}/resources") @Produces(MediaType.APPLICATION_JSON) public List<Resource> getFrameworkResources(@PathParam("frameworkId") String frameworkId) { return resourceService.listResourcesWithFramework(frameworkId); } @Inject  FrameworkResource(FrameworkService frameworkService,
            ComponentService componentService, ResourceService resourceService,
            SerializationService serializationService); @GET @Produces(MediaType.APPLICATION_JSON) List<Framework> listFrameworks(); @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) Framework saveFramework(@FormDataParam("file") byte[] frameworkJar, 
            @FormDataParam("isPublic") @DefaultValue("false") boolean isPublic); @GET @Path("/{frameworkId}") @Produces(MediaType.APPLICATION_JSON) Framework getFramework(@PathParam("frameworkId") String frameworkId); @DELETE @Path("/{frameworkId}") Response deleteFramework(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/jar") @Produces("application/java-archive") Response getFrameworkJar(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/components") @Produces(MediaType.APPLICATION_JSON) List<Component> getFrameworkComponents(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/resources") @Produces(MediaType.APPLICATION_JSON) List<Resource> getFrameworkResources(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/serializations") @Produces(MediaType.APPLICATION_JSON) List<Serialization> getFrameworkSerializations(@PathParam("frameworkId") String frameworkId); }
FrameworkResource { @GET @Path("/{frameworkId}/resources") @Produces(MediaType.APPLICATION_JSON) public List<Resource> getFrameworkResources(@PathParam("frameworkId") String frameworkId) { return resourceService.listResourcesWithFramework(frameworkId); } @Inject  FrameworkResource(FrameworkService frameworkService,
            ComponentService componentService, ResourceService resourceService,
            SerializationService serializationService); @GET @Produces(MediaType.APPLICATION_JSON) List<Framework> listFrameworks(); @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) Framework saveFramework(@FormDataParam("file") byte[] frameworkJar, 
            @FormDataParam("isPublic") @DefaultValue("false") boolean isPublic); @GET @Path("/{frameworkId}") @Produces(MediaType.APPLICATION_JSON) Framework getFramework(@PathParam("frameworkId") String frameworkId); @DELETE @Path("/{frameworkId}") Response deleteFramework(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/jar") @Produces("application/java-archive") Response getFrameworkJar(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/components") @Produces(MediaType.APPLICATION_JSON) List<Component> getFrameworkComponents(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/resources") @Produces(MediaType.APPLICATION_JSON) List<Resource> getFrameworkResources(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/serializations") @Produces(MediaType.APPLICATION_JSON) List<Serialization> getFrameworkSerializations(@PathParam("frameworkId") String frameworkId);  }