@Test public void deleteAnOrganizationThatDoesNotExist(){ final RepositoryHandler repositoryHandler = mock(RepositoryHandler.class); final OrganizationHandler handler = new OrganizationHandler(repositoryHandler); WebApplicationException exception = null; try { handler.deleteOrganization("doesNotExist"); }catch (WebApplicationException e){ exception = e; } assertNotNull(exception); Assert.assertEquals(Response.Status.NOT_FOUND.getStatusCode(), exception.getResponse().getStatus()); }
public void deleteOrganization(final String organizationId) { final DbOrganization dbOrganization = getOrganization(organizationId); repositoryHandler.deleteOrganization(dbOrganization.getName()); repositoryHandler.removeModulesOrganization(dbOrganization); }
OrganizationHandler { public void deleteOrganization(final String organizationId) { final DbOrganization dbOrganization = getOrganization(organizationId); repositoryHandler.deleteOrganization(dbOrganization.getName()); repositoryHandler.removeModulesOrganization(dbOrganization); } }
OrganizationHandler { public void deleteOrganization(final String organizationId) { final DbOrganization dbOrganization = getOrganization(organizationId); repositoryHandler.deleteOrganization(dbOrganization.getName()); repositoryHandler.removeModulesOrganization(dbOrganization); } OrganizationHandler(final RepositoryHandler repositoryHandler); }
OrganizationHandler { public void deleteOrganization(final String organizationId) { final DbOrganization dbOrganization = getOrganization(organizationId); repositoryHandler.deleteOrganization(dbOrganization.getName()); repositoryHandler.removeModulesOrganization(dbOrganization); } OrganizationHandler(final RepositoryHandler repositoryHandler); void store(final DbOrganization dbOrganization); List<String> getOrganizationNames(); DbOrganization getOrganization(final String organizationId); void deleteOrganization(final String organizationId); List<String> getCorporateGroupIds(final String organizationId); void addCorporateGroupId(final String organizationId, final String corporateGroupId); void removeCorporateGroupId(final String organizationId, final String corporateGroupId); DbOrganization getMatchingOrganization(final DbModule dbModule); }
OrganizationHandler { public void deleteOrganization(final String organizationId) { final DbOrganization dbOrganization = getOrganization(organizationId); repositoryHandler.deleteOrganization(dbOrganization.getName()); repositoryHandler.removeModulesOrganization(dbOrganization); } OrganizationHandler(final RepositoryHandler repositoryHandler); void store(final DbOrganization dbOrganization); List<String> getOrganizationNames(); DbOrganization getOrganization(final String organizationId); void deleteOrganization(final String organizationId); List<String> getCorporateGroupIds(final String organizationId); void addCorporateGroupId(final String organizationId, final String corporateGroupId); void removeCorporateGroupId(final String organizationId, final String corporateGroupId); DbOrganization getMatchingOrganization(final DbModule dbModule);  }