Skip to content

Commit

Permalink
Clean up created test user to avoid conflict with other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ahus1 committed Oct 16, 2023
1 parent 7dda393 commit 50916d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public static String encodeException(Throwable t) {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void testUpdatingAttributesWorksEvenWithEmptyAttributes() {
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);
});
}
Expand Down Expand Up @@ -201,6 +201,9 @@ public void testMultiValuedAttributes() {

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);
});
}
}

0 comments on commit 50916d5

Please sign in to comment.