ou.add( "apache", "acme corp" );
modifiedEntry.put( ou );
Dn dn = new Dn( "cn=test, ou=system" );
Modification mod = new DefaultModification(
ModificationOperation.REMOVE_ATTRIBUTE,
new DefaultAttribute( "ou", "acme corp" ) );
LdifEntry reversed = LdifRevertor.reverseModify( dn,
Collections.<Modification>singletonList( mod ), modifiedEntry );
assertNotNull( reversed );
assertEquals( dn.getName(), reversed.getDn().getName() );
assertEquals( ChangeType.Modify, reversed.getChangeType() );
assertNull( reversed.getEntry() );
List<Modification> mods = reversed.getModificationItems();
assertNotNull( mods );
assertEquals( 1, mods.size() );
Modification modif = mods.get( 0 );
assertEquals( ModificationOperation.ADD_ATTRIBUTE, modif.getOperation() );
Attribute attr = modif.getAttribute();
assertNotNull( attr );
assertEquals( "ou", attr.getId() );
assertEquals( "acme corp", attr.getString() );