public void deleteByUserUuid(DbSession dbSession, String userUuid) {
mapper(dbSession).deleteByUserUuid(userUuid);
}
+
+ public void deleteByScimUuid(DbSession dbSession, String scimUuid) {
+ mapper(dbSession).deleteByScimUuid(scimUuid);
+ }
}
}
@Test
- public void deleteFromUserUuid_shouldDeleteScimUser() {
+ public void deleteByUserUuid_shouldDeleteScimUser() {
ScimUserTestData scimUserTestData = insertScimUser("scimUser");
scimUserDao.deleteByUserUuid(dbSession, scimUserTestData.getUserUuid());
assertThat(scimUserDao.findAll(dbSession)).isEmpty();
}
+ @Test
+ public void deleteByScimUuid_shouldDeleteScimUser() {
+ ScimUserTestData scimUserTestData = insertScimUser("scimUser");
+ ScimUserTestData scimUserTestData2 = insertScimUser("scimUser2");
+
+ scimUserDao.deleteByScimUuid(dbSession, scimUserTestData.getScimUserUuid());
+
+ List<ScimUserDto> remainingUsers = scimUserDao.findAll(dbSession);
+ assertThat(remainingUsers).hasSize(1);
+
+ ScimUserDto remainingUser = remainingUsers.get(0);
+ assertThat(remainingUser.getScimUserUuid()).isEqualTo(scimUserTestData2.scimUserUuid);
+ assertThat(remainingUser.getUserUuid()).isEqualTo(scimUserTestData2.userUuid);
+ }
+
@Test
public void deleteFromUserUuid_shouldNotFail_whenNoUser() {
assertThatCode(() -> scimUserDao.deleteByUserUuid(dbSession, randomAlphanumeric(6))).doesNotThrowAnyException();