@Test
public void testRecordOperation() {

    final LdapName expectedDn = LdapUtils.newLdapName(
            "cn=john doe");
    final LdapName expectedTempDn = LdapUtils.newLdapName(
            "cn=john doe");
    RebindOperationRecorder tested = new RebindOperationRecorder(
            ldapOperationsMock, renamingStrategyMock);
    when(renamingStrategyMock.getTemporaryName(expectedDn))
            .thenReturn(expectedTempDn);
    Object expectedObject = new Object();
    BasicAttributes expectedAttributes = new BasicAttributes();
    // perform test
    CompensatingTransactionOperationExecutor result = tested
            .recordOperation(new Object[] { expectedDn, expectedObject,
                    expectedAttributes });
    assertThat(result instanceof RebindOperationExecutor).isTrue();
    RebindOperationExecutor rollbackOperation = (RebindOperationExecutor) result;
    assertThat(rollbackOperation.getLdapOperations()).isSameAs(ldapOperationsMock);
    assertThat(rollbackOperation.getOriginalDn()).isSameAs(expectedDn);
    assertThat(rollbackOperation.getTemporaryDn()).isSameAs(expectedTempDn);
    assertThat(rollbackOperation.getOriginalObject()).isSameAs(expectedObject);
    assertThat(rollbackOperation.getOriginalAttributes()).isSameAs(expectedAttributes);
}