@Test
public void testAddValueArray()
{
EntryAttribute attr1 = new DefaultServerAttribute( atCN );
int nbAdded = attr1.add( new StringValue( atCN, null ) );
assertEquals( 1, nbAdded );
assertTrue( attr1.isHR() );
assertEquals( NULL_STRING_VALUE, attr1.get() );
EntryAttribute attr2 = new DefaultServerAttribute( atPwd );
nbAdded = attr2.add( new BinaryValue( atPwd, null ) );
assertEquals( 1, nbAdded );
assertFalse( attr2.isHR() );
assertEquals( NULL_BINARY_VALUE, attr2.get() );
EntryAttribute attr3 = new DefaultServerAttribute( atCN );
nbAdded = attr3.add( new StringValue( atCN, "a" ), new StringValue( atCN, "b" ) );
assertEquals( 2, nbAdded );
assertTrue( attr3.isHR() );
assertTrue( attr3.contains( "a" ) );
assertTrue( attr3.contains( "b" ) );
EntryAttribute attr4 = new DefaultServerAttribute( atCN );
nbAdded = attr4.add( new BinaryValue( atPwd, BYTES1 ), new BinaryValue( atPwd, BYTES2 ) );
assertEquals( 0, nbAdded );
assertTrue( attr4.isHR() );
assertFalse( attr4.contains( BYTES1 ) );
assertFalse( attr4.contains( BYTES2 ) );
EntryAttribute attr5 = new DefaultServerAttribute( atCN );
nbAdded = attr5.add( new StringValue( atCN, "c" ), new BinaryValue( atPwd, BYTES1 ) );
assertEquals( 1, nbAdded );
assertTrue( attr5.isHR() );
assertFalse( attr5.contains( "ab" ) );
assertTrue( attr5.contains( "c" ) );
EntryAttribute attr6 = new DefaultServerAttribute( atPwd );
nbAdded = attr6.add( new BinaryValue( atPwd, BYTES1 ), new StringValue( atCN, "c" ) );
assertEquals( 1, nbAdded );
assertFalse( attr6.isHR() );
assertTrue( attr6.contains( BYTES1 ) );
assertFalse( attr6.contains( BYTES3 ) );
EntryAttribute attr7 = new DefaultServerAttribute( atPwd );
nbAdded = attr7.add( new BinaryValue( atPwd, null ), new StringValue( atCN, "c" ) );
assertEquals( 1, nbAdded );
assertFalse( attr7.isHR() );
assertTrue( attr7.contains( NULL_BINARY_VALUE ) );
assertFalse( attr7.contains( BYTES3 ) );
EntryAttribute attr8 = new DefaultServerAttribute( atCN );
nbAdded = attr8.add( new StringValue( atCN, null ), new BinaryValue( atPwd, BYTES1 ) );
assertEquals( 1, nbAdded );
assertTrue( attr8.isHR() );
assertTrue( attr8.contains( NULL_STRING_VALUE ) );
assertFalse( attr8.contains( "ab" ) );
EntryAttribute attr9 = new DefaultServerAttribute( atCN );
nbAdded = attr9.add( new StringValue( (String)null ), new StringValue( "ab" ) );
assertEquals( 2, nbAdded );
assertTrue( attr9.isHR() );
assertTrue( attr9.contains( NULL_STRING_VALUE ) );
assertTrue( attr9.contains( "ab" ) );