### Question:
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();  }### Answer:
@Test public void testToString() { assertEquals(String.format("Customer{id=%s, firstName='%s', lastName='%s'}", customer.getId(), customer.getFirstName(), customer.getLastName()), customer.toString()); }
@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()); }