ModuleHandler { public void deleteModule(final String moduleId) { final DbModule module = getModule(moduleId); repositoryHandler.deleteModule(module.getId()); for (final String gavc : DataUtils.getAllArtifacts(module)) { repositoryHandler.deleteArtifact(gavc); } } ModuleHandler(final RepositoryHandler repositoryHandler); void store(final DbModule dbModule); List<String> getModuleNames(final FiltersHolder filters); List<String> getModuleVersions(final String name, final FiltersHolder filters); DbModule getModule(final String moduleId); void deleteModule(final String moduleId); List<DbLicense> getModuleLicenses(final String moduleId,
                                             final LicenseMatcher licenseMatcher); void promoteModule(final String moduleId); PromotionReportView getPromotionReport(final String moduleId); DbOrganization getOrganization(final DbModule module); List<DbModule> getModules(final FiltersHolder filters);  }
@Test public void deleteAModuleThatDoesNotExist(){ final RepositoryHandler repositoryHandler = mock(RepositoryHandler.class); final ModuleHandler handler = new ModuleHandler(repositoryHandler); WebApplicationException exception = null; try{ handler.deleteModule("doesNotExist"); } catch (WebApplicationException e){ exception = e; } assertNotNull(exception); assertEquals(javax.ws.rs.core.Response.Status.NOT_FOUND.getStatusCode(), exception.getResponse().getStatus()); }