- wrong bait, wrong fish, wrong test ...
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) {
+ // Not valid id number
+ throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
} else if (user.getUserContact() == null) {
// Throw NPE again
throw new NullPointerException("user.userContact is null"); //NOI18N