@Test public void testToString() { final StringBuffer buffer = new StringBuffer(); buffer.append("Customer{id=") .append("" + customer.getId()) .append(", firstName='") .append(customer.getFirstName()) .append("\', lastName='") .append(customer.getLastName() + "\'}"); assertEquals(buffer.toString(), customer.toString()); }
@Override public String toString() { return "Customer{" + "id=" + getId() + ", firstName='" + getFirstName() + '\'' + ", lastName='" + getLastName() + '\'' + '}'; }
Customer { @Override public String toString() { return "Customer{" + "id=" + getId() + ", firstName='" + getFirstName() + '\'' + ", lastName='" + getLastName() + '\'' + '}'; } }
Customer { @Override public String toString() { return "Customer{" + "id=" + getId() + ", firstName='" + getFirstName() + '\'' + ", lastName='" + getLastName() + '\'' + '}'; } Customer(final int id, final String firstName, final String lastName); }
Customer { @Override public String toString() { return "Customer{" + "id=" + getId() + ", firstName='" + getFirstName() + '\'' + ", lastName='" + getLastName() + '\'' + '}'; } Customer(final int id, final String firstName, final String lastName); int getId(); void setId(final int id); String getFirstName(); void setFirstName(final String firstName); String getLastName(); void setLastName(final String lastName); @Override String toString(); @Override boolean equals(final Object that); @Override int hashCode(); }
Customer { @Override public String toString() { return "Customer{" + "id=" + getId() + ", firstName='" + getFirstName() + '\'' + ", lastName='" + getLastName() + '\'' + '}'; } Customer(final int id, final String firstName, final String lastName); int getId(); void setId(final int id); String getFirstName(); void setFirstName(final String firstName); String getLastName(); void setLastName(final String lastName); @Override String toString(); @Override boolean equals(final Object that); @Override int hashCode();  }