User extends BaseModel<User> { public boolean validate() { return !(userName == null || email == null); } User();  User(String userId, String name, String password, Role role);  User(String userId, String name, String password, String email, Role role); @PrePersist @PreUpdate void init(); static User createNew(); boolean validate(); @Override int hashCode(); @Override boolean equals(Object obj); Boolean isEnabled(); void setEmail(String email); boolean isExternal(); @JsonIgnore User getFactualUser(); @JsonIgnore User getUserBaseInfo(); @Override String toString();  }
@Test public void testValidate() { User user1 = new User("Uid1", "name1", "pwd1", "user1@nhn.com", Role.USER); user1.setEmail("aa@bb.com"); assertTrue(user1.validate()); User user2 = new User(); user2 = new User("Uid1", null, "pwd1", "user2@nhn.com", Role.USER); assertTrue(!user2.validate()); user2 = new User("Uid1", "name", "pwd1", "user2@nhn.com", null); assertTrue(user2.validate()); assertTrue(user2.getRole() == null); @SuppressWarnings("deprecation") User user3 = new User("Uid1", "name", "pwd1", null); assertTrue(!user3.validate()); }