assertEquals( 1, tori.get( "cn" ).size() );
assertEquals( "Tori Amos", tori.get( "cn" ).get() );
assertNotNull( tori.get( "sn" ) );
// Test an add operation first
ModificationItem mod = new ModificationItem( DirContext.ADD_ATTRIBUTE, new BasicAttribute( "cn", "foo" ) );
ctx.modifyAttributes( RDN, new ModificationItem[]
{ mod } );
tori = ctx.getAttributes( RDN );
assertNotNull( tori.get( "objectClass" ) );
assertNotNull( tori.get( "cn" ) );
assertEquals( 2, tori.get( "cn" ).size() );
assertEquals( "Tori Amos", tori.get( "cn" ).get( 0 ) );
assertEquals( "foo", tori.get( "cn" ).get( 1 ) );
assertNotNull( tori.get( "sn" ) );
// Now test remove of value ( bar ) that does not exist in cn
mod = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, new BasicAttribute( "cn", "bar" ) );
try
{
ctx.modifyAttributes( RDN, new ModificationItem[]
{ mod } );
fail();