AudioFoldersHandler extends AbstractFolderHandler { @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) public ConfigurationFolder addAudioFolder(final ConfigurationFolder folder) { return addFolder(folder); } @Inject  AudioFoldersHandler(final BackendManager backendManager); @GET @Produces(APPLICATION_JSON) Collection<ConfigurationFolder> getAudioFolders(); @GET @Path("/{id}") @Produces(APPLICATION_JSON) ConfigurationFolder getAudioFolder(@PathParam("id") final String id); @POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) ConfigurationFolder addAudioFolder(final ConfigurationFolder folder); @PUT @Path("/{id}") @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) ConfigurationFolder editAudioFolder(@PathParam("id") final String id, final ConfigurationFolder folder); @DELETE @Path("/{id}") @Produces(APPLICATION_JSON) ConfigurationFolder removeAudioFolder(@PathParam("id") final String id);  }
@Test public void testAddAudioFolder() { BackendManager backendManager = createMock(BackendManager.class); ConfigurationFolder folder = new ConfigurationFolder(null, "newAudioFolder", System.getProperty("java.io.tmpdir")); backendManager.addFolder(folder, AUDIO); expectLastCall().atLeastOnce(); replay(backendManager); AudioFoldersHandler audioFoldersHandler = new AudioFoldersHandler(backendManager); ConfigurationFolder newFolder = audioFoldersHandler.addAudioFolder(folder); assertNotNull(newFolder); assertEquals(newFolder, folder); verify(backendManager); }