@Test public void membershipsHasReferentialIntegrity() {

  aclDAO.enrollClient(jooqContext.configuration(), client1.getId(), group1.getId());
  aclDAO.enrollClient(jooqContext.configuration(), client2.getId(), group2.getId());
  int before = membershipsTableSize();
  groupDAO.deleteGroup(group1);
  assertThat(membershipsTableSize()).isEqualTo(before - 1);
  clientDAO.deleteClient(client2);
  assertThat(membershipsTableSize()).isEqualTo(before - 2);
}