### Question:
IdName extends Hash { @Override public final boolean equals( Object obj ) { if (obj == this) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; IdName other = (IdName) obj; return id.equals( other.id ) && name.equals( other.name ); } 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 equalsObject() { assertTrue( new IdName( 1, "foo" ).equals( new IdName( 1, "foo" ) ) ); assertTrue( new IdName( 1, "bar" ).equals( new IdName( 1, "bar" ) ) ); assertTrue( new IdName( 2, "foo" ).equals( new IdName( 2, "foo" ) ) ); assertTrue( new IdName( 2, "bar" ).equals( new IdName( 2, "bar" ) ) ); assertFalse( new IdName( 1, "foo" ).equals( new IdName( 2, "foo" ) ) ); assertFalse( new IdName( 1, "foo" ).equals( new IdName( 1, "bar" ) ) ); assertFalse( new IdName( 1, "foo" ).equals( new IdName( 2, "bar" ) ) ); assertFalse( new IdName( 1, "foo" ).equals( null ) ); assertFalse( new IdName( 1, "foo" ).equals( 1 ) ); assertFalse( new IdName( 1, "foo" ).equals( true ) ); assertFalse( new IdName( 1, "foo" ) {}.equals( new IdName( 1, "foo" ) {} ) ); }