* Test method hashCode()
*/
@Test
public void testHashCode() throws LdapException
{
Attribute attr1 = new DefaultAttribute( atDC );
Attribute attr2 = new DefaultAttribute( atSN );
assertNotSame( attr1.hashCode(), attr2.hashCode() );
attr2.apply( atDC );
assertEquals( attr1.hashCode(), attr2.hashCode() );
attr1.add( ( String ) null );
assertNotSame( attr1.hashCode(), attr2.hashCode() );
attr1.clear();
assertEquals( attr1.hashCode(), attr2.hashCode() );
attr1.add( "a", "b" );
assertNotSame( attr1.hashCode(), attr2.hashCode() );
attr2.add( "a", "b" );
assertEquals( attr1.hashCode(), attr2.hashCode() );
// Order matters
attr2.clear();
attr2.add( "b", "a" );
assertNotSame( attr1.hashCode(), attr2.hashCode() );
Attribute attr3 = new DefaultAttribute( atPwd );
Attribute attr4 = new DefaultAttribute( atPwd );
assertNotSame( attr3.hashCode(), attr4.hashCode() );
attr3.add( ( byte[] ) null );
assertNotSame( attr3.hashCode(), attr4.hashCode() );
attr3.clear();
assertEquals( attr3.hashCode(), attr4.hashCode() );
attr3.add( new byte[]
{ 0x01, 0x02 }, new byte[]
{ 0x03, 0x04 } );
assertNotSame( attr1.hashCode(), attr2.hashCode() );
attr4.add( new byte[]
{ 0x01, 0x02 }, new byte[]
{ 0x03, 0x04 } );
assertNotSame( attr1.hashCode(), attr2.hashCode() );
// Order matters
attr4.clear();
attr4.add( new byte[]
{ 0x03, 0x04 }, new byte[]
{ 0x01, 0x02 } );
assertNotSame( attr1.hashCode(), attr2.hashCode() );
}