@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);
    // Perform test
    CompensatingTransactionOperationExecutor operation = tested
            .recordOperation(new Object[] { expectedDn });
    // Verify result
    assertThat(operation instanceof UnbindOperationExecutor).isTrue();
    UnbindOperationExecutor rollbackOperation = (UnbindOperationExecutor) operation;
    assertThat(rollbackOperation.getLdapOperations()).isSameAs(ldapOperationsMock);
    assertThat(rollbackOperation.getOriginalDn()).isSameAs(expectedDn);
    assertThat(rollbackOperation.getTemporaryDn()).isSameAs(expectedTempName);
}