OrganizationManager { public Page<? extends Organization> getByParent(String parent, int maxItems, long skipCount) throws ServerException { requireNonNull(parent, "Required non-null parent"); return organizationDao.getByParent(parent, maxItems, skipCount); } @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 shouldThrowNpeWhenGettingSuborganizationsByNullParent() throws Exception { manager.getByParent(null, 30, 0); }
@Test public void shouldGetOrganizationsByParent() throws Exception { final OrganizationImpl toFetch = new OrganizationImpl("org321", "toFetchOrg", "org123"); when(organizationDao.getByParent(eq("org123"), anyInt(), anyLong())) .thenReturn(new Page<>(singletonList(toFetch), 0, 1, 1)); final Page<? extends Organization> organizations = manager.getByParent("org123", 30, 0); assertEquals(organizations.getItemsCount(), 1); assertEquals(organizations.getItems().get(0), toFetch); verify(organizationDao).getByParent("org123", 30, 0); }