User extends Immutable { @Override public String toString() { return "User [userId=" + userId + ", username=" + username + ", email=" + email + ", firstname=" + firstname + ", lastname=" + lastname + "]"; } User(int userId, String username, String email, String firstname, String lastname);  User(); int getUserId(); String getUsername(); void setUsername(String username); String getEmail(); void setEmail(String email); String getFirstname(); void setFirstname(String firstname); String getLastname(); void setLastname(String lastname); String getFullname(); @Override String toString();  }
@Test public void testToString() { User user = new User(1, "jad", "jane21@gmail.com", "Jane", "Doe"); assertEquals("User [userId=1, username=jad, email=jane21@gmail.com, firstname=Jane, lastname=Doe]", user.toString()); User userWithNullStrings = new User(1, null, null, null, null); assertEquals("User [userId=1, username=null, email=null, firstname=null, lastname=null]", userWithNullStrings.toString()); }