]> git.mxchange.org Git - pizzaservice-mailer-ejb.git/commitdiff
Fixed wrong tests: (please cherry-pick)
authorRoland Häder <roland@mxchange.org>
Thu, 11 Aug 2016 10:11:22 +0000 (12:11 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 16 Aug 2016 19:42:48 +0000 (21:42 +0200)
- locking/unlocking an existing user account always have a valid user id set

src/java/org/mxchange/jusercore/model/user/AddressbookAdminUserSessionBean.java

index f42f0131f4adc1e0277fab3eb5b532121b9c799e..2bfda85ff5d68aeea4218f3fdbd2e25d1cbfcd6c 100644 (file)
@@ -169,9 +169,12 @@ public class AddressbookAdminUserSessionBean extends BaseAddressbookDatabaseBean
                if (null == user) {
                        // Abort here
                        throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() instanceof Long) {
+               } else if (user.getUserId() == null) {
                        // Id is set
-                       throw new IllegalArgumentException("user.userId is not null"); //NOI18N
+                       throw new NullPointerException("user.userId is null"); //NOI18N
+               } else if (user.getUserId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is null", user.getUserId())); //NOI18N
                } else if (user.getUserContact() == null) {
                        // Throw NPE again
                        throw new NullPointerException("user.userContact is null"); //NOI18N
@@ -256,9 +259,12 @@ public class AddressbookAdminUserSessionBean extends BaseAddressbookDatabaseBean
                if (null == user) {
                        // Abort here
                        throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() instanceof Long) {
+               } else if (user.getUserId() == null) {
                        // Id is set
-                       throw new IllegalArgumentException("user.userId is not null"); //NOI18N
+                       throw new NullPointerException("user.userId is null"); //NOI18N
+               } else if (user.getUserId() < 1) {
+                       // Id is set
+                       throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is null", user.getUserId())); //NOI18N
                } else if (user.getUserContact() == null) {
                        // Throw NPE again
                        throw new NullPointerException("user.userContact is null"); //NOI18N