User { @Override public String toString() { return firstName + " " + lastName; } User(String firstName, String lastName); @Override String toString(); final String firstName; final String lastName; }
@Test public void testToString() throws Exception { Assert.assertEquals(firstName + " " + lastName, user.toString()); }