    @Test
    public void testGetOrCreateSubjectRef() throws SQLException {

        try (SqlDao dao = sqlStore.getDao()) {
            assertFalse(dao.getSubjectRef("group", "admin").isPresent());
            SubjectRef created = dao.getOrCreateSubjectRef("group", "admin");
            SubjectRef fetched = dao.getSubjectRef("group", "admin").get();
            assertEquals(created.getId(), fetched.getId());

            SubjectRef couldBeCreated = dao.getOrCreateSubjectRef("group", "admin");
            assertEquals(created.getId(), couldBeCreated.getId());

            SubjectRef gottenById = dao.getSubjectRef(created.getId()).get();
            assertEquals(created.getId(), gottenById.getId());
            assertEquals(created, gottenById);
        }
    }