예제 #1
0
  @Test
  public void testRemoveAggregation() throws Exception {
    String id = groupService.create(group);
    groupService.addAggregation(committee, group);

    Group fromDb = groupService.findById(id);
    assertEquals(1, fromDb.getAggregations().size());
    assertEquals(1, fromDb.getAggregations().iterator().next().getGroups().size());

    Aggregation aggregation = committeeService.findById(committee.getId());
    assertEquals(1, aggregation.getGroups().size());

    groupService.removeAggregation(committee, fromDb);

    fromDb = groupService.findById(id);
    assertEquals(0, fromDb.getAggregations().size());

    aggregation = committeeService.findById(committee.getId());
    assertEquals(0, aggregation.getGroups().size());
  }