PictureFoldersHandler extends AbstractFolderHandler { @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) public ConfigurationFolder addPictureFolder(final ConfigurationFolder folder) { return addFolder(folder); } @Inject  PictureFoldersHandler(final BackendManager backendManager); @GET @Produces(APPLICATION_JSON) Collection<ConfigurationFolder> getPictureFolders(); @GET @Path("/{id}") @Produces(APPLICATION_JSON) ConfigurationFolder getPictureFolder(@PathParam("id") final String id); @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) ConfigurationFolder addPictureFolder(final ConfigurationFolder folder); @PUT @Path("/{id}") @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) ConfigurationFolder editPictureFolder(@PathParam("id") final String id, final ConfigurationFolder folder); @DELETE @Path("/{id}") @Produces(APPLICATION_JSON) ConfigurationFolder removePictureFolder(@PathParam("id") final String id);  }
@Test public void testAddPictureFolder() { BackendManager backendManager = createMock(BackendManager.class); ConfigurationFolder folder = new ConfigurationFolder(null, "newImagesTest", System.getProperty("java.io.tmpdir")); backendManager.addFolder(folder, PICTURE); expectLastCall().atLeastOnce(); replay(backendManager); PictureFoldersHandler pictureFoldersHandler = new PictureFoldersHandler(backendManager); ConfigurationFolder newFolder = pictureFoldersHandler.addPictureFolder(folder); assertNotNull(newFolder); assertEquals(newFolder, folder); verify(backendManager); }