From 7ecc533f8e74819ecdf6850ad3a33ee1662cd418 Mon Sep 17 00:00:00 2001 From: Steffen Schaefer Date: Thu, 7 Jul 2016 10:38:53 +0200 Subject: [PATCH] Added a failing test to verify that getUserByEmail currently throws a NullPointerException if there is no user for a given email address --- .../test/UserStoreWithPersistenceTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/java/com.sap.sse.security.test/src/com/sap/sse/security/test/UserStoreWithPersistenceTest.java b/java/com.sap.sse.security.test/src/com/sap/sse/security/test/UserStoreWithPersistenceTest.java index b081c04ee30..a155bfcef03 100644 --- a/java/com.sap.sse.security.test/src/com/sap/sse/security/test/UserStoreWithPersistenceTest.java +++ b/java/com.sap.sse.security.test/src/com/sap/sse/security/test/UserStoreWithPersistenceTest.java @@ -55,6 +55,22 @@ public class UserStoreWithPersistenceTest { assertNotNull(store.getUserByEmail(email)); } + /** + * There was a {@link NullPointerException} thrown if calling getUserByEmail for an email address for which there + * wasn't an associated user. + */ + @Test + public void testDeleteUser() throws UserManagementException { + store.createUser(username, email); + store.deleteUser(username); + assertNull(store.getUserByName(username)); + assertNull(store.getUserByEmail(email)); + + newStore(); + assertNull(store.getUserByName(username)); + assertNull(store.getUserByEmail(email)); + } + @Test public void testSetPreferences() throws UserManagementException { store.createUser(username, email);