### Question:
IdName extends Hash { @Override public final String toString() { return String.format( "%s(%d)", name, id ); } IdName( Integer id, String name );  IdName( String name ); final Integer getId(); final String getName(); @Override final String toString(); @Override final boolean equals( Object obj ); @Override final int hashCode();  }### Answer:
@Test public void xtoString() { assertEquals( "foo(1)", new IdName( 1, "foo" ).toString() ); assertEquals( "bar(1)", new IdName( 1, "bar" ).toString() ); assertEquals( "foo(2)", new IdName( 2, "foo" ).toString() ); assertEquals( "bar(2)", new IdName( 2, "bar" ).toString() ); }