RebindOperationExecutor implements
        CompensatingTransactionOperationExecutor { public void rollback() { log.debug("Rolling back rebind operation"); try { ldapOperations.unbind(originalDn); ldapOperations.rename(temporaryDn, originalDn); } catch (Exception e) { log.warn("Failed to rollback operation, dn: " + originalDn + "; temporary DN: " + temporaryDn, e); } } RebindOperationExecutor(LdapOperations ldapOperations,
            Name originalDn, Name temporaryDn, Object originalObject,
            Attributes originalAttributes); void rollback(); void commit(); void performOperation();  }
@Test public void testRollback() { LdapName expectedOriginalDn = LdapUtils.newLdapName( "cn=john doe"); LdapName expectedTempDn = LdapUtils.newLdapName( "cn=john doe_temp"); Object expectedObject = new Object(); BasicAttributes expectedAttributes = new BasicAttributes(); RebindOperationExecutor tested = new RebindOperationExecutor( ldapOperationsMock, expectedOriginalDn, expectedTempDn, expectedObject, expectedAttributes); tested.rollback(); verify(ldapOperationsMock).unbind(expectedOriginalDn); verify(ldapOperationsMock).rename(expectedTempDn, expectedOriginalDn); }