OrganizationManager { @Transactional(rollbackOn = {RuntimeException.class, ApiException.class}) public Organization update(String organizationId, Organization update) throws NotFoundException, ConflictException, ServerException { requireNonNull(organizationId, "Required non-null organization id"); requireNonNull(update, "Required non-null organization"); requireNonNull(update.getName(), "Required non-null organization name"); final OrganizationImpl organization = organizationDao.getById(organizationId); final String oldQualifiedName = organization.getQualifiedName(); final String oldName = organization.getName(); final String newName = update.getName(); final String newQualifiedName = buildQualifiedName(oldQualifiedName, update.getName()); checkNameReservation(newQualifiedName); organization.setQualifiedName(newQualifiedName); organizationDao.update(organization); if (!newName.equals(oldName)) { updateSuborganizationsQualifiedNames(oldQualifiedName, organization.getQualifiedName()); final String performerName = EnvironmentContext.getCurrent().getSubject().getUserName(); eventService.publish( asDto(new OrganizationRenamedEvent(performerName, oldName, newName, organization))); } return organization; } @Inject  OrganizationManager(
      EventService eventService,
      OrganizationDao organizationDao,
      MemberDao memberDao,
      @Named("che.auth.reserved_user_names") String[] reservedNames); @Transactional(rollbackOn = {RuntimeException.class, ApiException.class}) Organization create(Organization newOrganization); @Transactional(rollbackOn = {RuntimeException.class, ApiException.class}) Organization update(String organizationId, Organization update); @Transactional(rollbackOn = {RuntimeException.class, ApiException.class}) void remove(String organizationId); Organization getById(String organizationId); Organization getByName(String organizationName); Page<? extends Organization> getByParent(String parent, int maxItems, long skipCount); Page<OrganizationImpl> getSuborganizations(
      String parentQualifiedName, int maxItems, long skipCount); Page<? extends Organization> getByMember(String userId, int maxItems, int skipCount); Page<? extends Member> getMembers(String organizationId, int maxItems, long skipCount);  }
@Test(expectedExceptions = NullPointerException.class) public void shouldThrowNpeWhenUpdatingOrganizationWithNullEntity() throws Exception { manager.update("organizationId", null); }
@Test(expectedExceptions = NullPointerException.class) public void shouldThrowNpeWhenUpdatingOrganizationByNullId() throws Exception { manager.update(null, new OrganizationImpl()); }