Account extends Immutable { @Override public String toString() { return "Account [getAccountId()=" + getAccountId() + ", getUsername()=" + getUsername() + ", getFirstName()=" + getFirstName() + ", getLastName()=" + getLastName() + "]"; } Account();  Account(int accountId, String username, String firstName, String lastName, double balance); int getAccountId(); String getUsername(); String getFirstName(); String getLastName(); String getFullName(); double getBalance(); void setBalance(double balance); @Override String toString();  }
@Test public void testToString() { Account account = new Account(1, "jad", "Jane", "Doe", 1); assertEquals("Account [getAccountId()=1, getUsername()=jad, getFirstName()=Jane, getLastName()=Doe]", account.toString()); Account accountWithNullStrings = new Account(1, null, null, null, 1); assertEquals("Account [getAccountId()=1, getUsername()=null, getFirstName()=null, getLastName()=null]", accountWithNullStrings.toString()); }