* Tests for equality when a different implementation is used.
*/
@Test
public void testEqualsDiffImpl()
{
SearchResultReference resp0 = new SearchResultReference()
{
public Referral getReferral()
{
return SearchResponseReferenceImplTest.this.getReferral( this );
}
public void setReferral( Referral referral )
{
}
public MessageTypeEnum getType()
{
return MessageTypeEnum.SEARCH_RESULT_REFERENCE;
}
public Map<String, Control> getControls()
{
return EMPTY_CONTROL_MAP;
}
public SearchResultReference addControl( Control control ) throws MessageException
{
return this;
}
public SearchResultReference removeControl( Control control ) throws MessageException
{
return this;
}
public int getMessageId()
{
return 5;
}
public Object get( Object key )
{
return null;
}
public Object put( Object key, Object value )
{
return null;
}
public SearchResultReference addAllControls( Control[] controls ) throws MessageException
{
return this;
}
public boolean hasControl( String oid )
{
return false;
}
public Control getControl( String oid )
{
return null;
}
public SearchResultReference setMessageId( int messageId )
{
return this;
}
};
SearchResultReferenceImpl resp1 = new SearchResultReferenceImpl( 5 );
getReferral( resp1 );
assertFalse( "using Object.equal() should NOT be equal", resp0.equals( resp1 ) );
assertTrue( "same but different implementations should be equal", resp1.equals( resp0 ) );
}