Credentials implements ToStringMixin { public Credentials(String username, String password) { this.username = username; this.password = password; } Credentials(String username, String password); boolean isEqualTo(Credentials otherCredentials); String getUsername(); String getPassword(); @Override String toString();  }
@Test public void testCredentials() { String userName = "user"; String userPassword = "passwd"; Credentials credentials = new Credentials(userName, userPassword); assert credentials.isEqualTo(new Credentials(userName, userPassword)); assert userName.equals(credentials.getUsername()); assert userPassword.equals(credentials.getPassword()); assert credentials.toString().equals(credentials.toReadableString()); }