Esempio n. 1
0
  @Test
  public void testCreateGroupFromCommittee() throws Exception {
    String id = groupService.create(group);
    groupService.addAggregation(committee, group);

    Group fromDb = groupService.findById(id);
    assertEquals(group.getGroupName(), fromDb.getGroupName());
    Aggregation aggregation = fromDb.getAggregations().iterator().next();
    assertNotNull(aggregation);
    assertEquals(
        committee.getAggregationMembers().size(), aggregation.getAggregationMembers().size());
  }
Esempio n. 2
0
  @Test
  public void testDeleteGroup() throws Exception {
    groupService.create(group);
    groupService.addAggregation(committee, group);

    group = groupService.findById(group.getId());
    contactService.addToGroup(topLevel, group);

    groupService.delete(group);

    Group groupFromDb = groupService.findById(group.getId());
    assertNull(groupFromDb);
    Aggregation fromDb = committeeService.findById(committee.getId());
    assertNotNull(fromDb);
    assertEquals(0, fromDb.getGroups().size());
    assertEquals(committee.getAggregationMembers().size(), fromDb.getAggregationMembers().size());

    Contact topLevelFromDb = contactService.findById(topLevel.getId());
    assertNotNull(topLevelFromDb);
    assertEquals(0, topLevelFromDb.getGroups().size());
  }