Clean up created test user to avoid conflict with other tests

Closes #23804
This commit is contained in:
Alexander Schwartz 2023-10-16 11:12:12 +02:00 committed by Alexander Schwartz
parent 7dda393120
commit 50916d58b1
2 changed files with 7 additions and 1 deletions

View file

@ -51,6 +51,9 @@ public class SerializationUtil {
oos.close();
return "EXCEPTION:" + Base64.encodeBytes(os.toByteArray());
} catch (NotSerializableException e) {
// when the exception can't be serialized, at least log the original exception, so it can be analyzed
throw new RuntimeException("Unable to serialize exception due to not serializable class " + e.getMessage(), t);
} catch (Exception e) {
throw new RuntimeException(e);
}

View file

@ -167,7 +167,7 @@ public class LDAPProvidersFullNameMapperTest extends AbstractLDAPTest {
MatcherAssert.assertThat(Arrays.asList("one", "two", "three"),
Matchers.containsInAnyOrder(fullnameUser.getAttributeStream("myAttrThreeValues").toArray(String[]::new)));
// Remove "fullnameUser" to assert he is removed from LDAP.
// Remove "fullnameUser" to prevent conflicts with other tests
session.users().removeUser(appRealm, fullnameUser);
});
}
@ -201,6 +201,9 @@ public class LDAPProvidersFullNameMapperTest extends AbstractLDAPTest {
UserModel fullnameUser = session.users().getUserByUsername(appRealm, "fullname");
Assert.assertEquals(Arrays.asList("role1", "role2"), fullnameUser.getAttributeStream("roles").collect(Collectors.toList()));
// Remove "fullnameUser" to prevent conflicts with other tests
session.users().removeUser(appRealm, fullnameUser);
});
}
}