@Test public void getComponentConfig() { final ComponentConfig mockedComponentConfig = new ComponentConfig(); mockedComponentConfig.setName("test-component"); mockedComponentConfig.setLabel("Test Component"); final Component mockedComponent = new Component(); mockedComponent.setId("COMPONENT_TO_GET"); mockedComponent.setConfig(mockedComponentConfig); when(componentServiceMock.getComponent(anyString())).thenReturn(mockedComponent); ComponentConfig responseComponentConfig = resource() .path("/api/components/" + mockedComponent.getId() + "/config") .accept(MediaType.APPLICATION_JSON).get(ComponentConfig.class); assertEquals("Response config should match the mocked config", mockedComponentConfig, responseComponentConfig); verify(componentServiceMock).getComponent(anyString()); }
@GET @Path("/{componentId}/config") @Produces(MediaType.APPLICATION_JSON) public ComponentConfig getComponentConfig(@PathParam("componentId") String componentId) { return componentService.getComponent(componentId).getConfig(); }
ComponentResource { @GET @Path("/{componentId}/config") @Produces(MediaType.APPLICATION_JSON) public ComponentConfig getComponentConfig(@PathParam("componentId") String componentId) { return componentService.getComponent(componentId).getConfig(); } }
ComponentResource { @GET @Path("/{componentId}/config") @Produces(MediaType.APPLICATION_JSON) public ComponentConfig getComponentConfig(@PathParam("componentId") String componentId) { return componentService.getComponent(componentId).getConfig(); } @Inject  ComponentResource(ComponentService componentService); }
ComponentResource { @GET @Path("/{componentId}/config") @Produces(MediaType.APPLICATION_JSON) public ComponentConfig getComponentConfig(@PathParam("componentId") String componentId) { return componentService.getComponent(componentId).getConfig(); } @Inject  ComponentResource(ComponentService componentService); @GET @Produces(MediaType.APPLICATION_JSON) Collection<Component> listComponents(@QueryParam("visibility") 
            @DefaultValue(Framework.VISIBILITY_ALL) String visibility); @GET @Path("/{componentId}") @Produces(MediaType.APPLICATION_JSON) Component getComponent(@PathParam("componentId") String componentId); @GET @Path("/{componentId}/config") @Produces(MediaType.APPLICATION_JSON) ComponentConfig getComponentConfig(@PathParam("componentId") String componentId); @GET @Path("/{componentId}/icon") @Produces("image/jpeg") Response getComponentIcon(@PathParam("componentId") String componentId); }
ComponentResource { @GET @Path("/{componentId}/config") @Produces(MediaType.APPLICATION_JSON) public ComponentConfig getComponentConfig(@PathParam("componentId") String componentId) { return componentService.getComponent(componentId).getConfig(); } @Inject  ComponentResource(ComponentService componentService); @GET @Produces(MediaType.APPLICATION_JSON) Collection<Component> listComponents(@QueryParam("visibility") 
            @DefaultValue(Framework.VISIBILITY_ALL) String visibility); @GET @Path("/{componentId}") @Produces(MediaType.APPLICATION_JSON) Component getComponent(@PathParam("componentId") String componentId); @GET @Path("/{componentId}/config") @Produces(MediaType.APPLICATION_JSON) ComponentConfig getComponentConfig(@PathParam("componentId") String componentId); @GET @Path("/{componentId}/icon") @Produces("image/jpeg") Response getComponentIcon(@PathParam("componentId") String componentId);  }