UnbindOperationRecorder implements
        CompensatingTransactionOperationRecorder { public CompensatingTransactionOperationExecutor recordOperation( Object[] args) { Name dn = LdapTransactionUtils.getFirstArgumentAsName(args); Name temporaryDn = renamingStrategy.getTemporaryName(dn); return new UnbindOperationExecutor(ldapOperations, dn, temporaryDn); } UnbindOperationRecorder(LdapOperations ldapOperations,
            TempEntryRenamingStrategy renamingStrategy); CompensatingTransactionOperationExecutor recordOperation(
            Object[] args); TempEntryRenamingStrategy getRenamingStrategy();  }
@Test public void testRecordOperation() { final LdapName expectedTempName = LdapUtils.newLdapName( "cn=john doe_temp"); final LdapName expectedDn = LdapUtils.newLdapName( "cn=john doe"); UnbindOperationRecorder tested = new UnbindOperationRecorder( ldapOperationsMock, renamingStrategyMock); when(renamingStrategyMock.getTemporaryName(expectedDn)) .thenReturn(expectedTempName); CompensatingTransactionOperationExecutor operation = tested .recordOperation(new Object[] { expectedDn }); assertThat(operation instanceof UnbindOperationExecutor).isTrue(); UnbindOperationExecutor rollbackOperation = (UnbindOperationExecutor) operation; assertThat(rollbackOperation.getLdapOperations()).isSameAs(ldapOperationsMock); assertThat(rollbackOperation.getOriginalDn()).isSameAs(expectedDn); assertThat(rollbackOperation.getTemporaryDn()).isSameAs(expectedTempName); }