@Test public void accessGrantsHasReferentialIntegrity() {

  aclDAO.allowAccess(jooqContext.configuration(), secret1.getId(), group1.getId());
  aclDAO.allowAccess(jooqContext.configuration(), secret2.getId(), group2.getId());
  int before = accessGrantsTableSize();
  groupDAO.deleteGroup(group1);
  assertThat(accessGrantsTableSize()).isEqualTo(before - 1);
  secretSeriesDAO.deleteSecretSeriesById(secret2.getId());
  assertThat(accessGrantsTableSize()).isEqualTo(before - 2);
}