connection.add( entry );
// Now modify the entry : we should replace the password with a null value
// and add a mail Attribute with a null value
connection.modify( new Dn( "uid=12345,ou=system" ),
new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "userPassword", Strings.EMPTY_BYTES ),
new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "mail", ( String ) null )
);
// Get back the entry
Entry found = connection.lookup( "uid=12345,ou=system" );
assertNotNull( found );
assertNotNull( found.get( "mail" ) );
assertNotNull( found.get( "userPassword" ) );
assertEquals( 1, found.get( "mail" ).size() );
assertEquals( 1, found.get( "userPassword" ).size() );
assertTrue( found.contains( "mail", Strings.EMPTY_BYTES ) );
assertTrue( found.contains( "userPassword", "" ) );
// Now, do a replace with no value. We should not anymore have a mail
connection.modify( new Dn( "uid=12345,ou=system" ),
new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "mail" )
);
// Get back the entry
found = connection.lookup( "uid=12345,ou=system" );