private void assertGroupEquals(Group expected, Group found) { assertThat(found).isNotNull(); assertThat(found).isEqualTo(expected); assertThat(found.getName()).isEqualTo(expected.getName()); assertThat(expected.getSubjectCredentials()).isEqualTo(found.getSubjectCredentials()); Asserts.assertCreatedTimestamps(expected, found); }
@Test public void test_create_new_group() { Group group = Group.Builder.create().name("group1").build(); subjectCredentialsService.createGroup(group.getName()); List<Group> groups = newArrayList(subjectCredentialsService.getGroups()); assertThat(groups).hasSize(1); assertGroupEquals(group, groups.get(0)); Group found = subjectCredentialsService.getGroup(group.getName()); assertGroupEquals(group, found); }
@Test public void test_delete_group() { Group group = Group.Builder.create().name("group1").build(); subjectCredentialsService.createGroup(group.getName()); subjectCredentialsService.delete(group); assertThat(subjectCredentialsService.getGroups()).isEmpty(); }