DifferentSubtreeTempEntryRenamingStrategy implements
        TempEntryRenamingStrategy { public Name getTemporaryName(Name originalName) { int thisSequenceNo = NEXT_SEQUENCE_NO.getAndIncrement(); LdapName tempName = LdapUtils.newLdapName(originalName); try { String leafNode = tempName.get(tempName.size() - 1) + thisSequenceNo; LdapName newName = LdapUtils.newLdapName(subtreeNode); newName.add(leafNode); return newName; } catch (InvalidNameException e) { throw new org.springframework.ldap.InvalidNameException(e); } } DifferentSubtreeTempEntryRenamingStrategy(Name subtreeNode);  DifferentSubtreeTempEntryRenamingStrategy(String subtreeNode); Name getSubtreeNode(); void setSubtreeNode(Name subtreeNode); Name getTemporaryName(Name originalName);  }
@Test public void testGetTemporaryName() { LdapName originalName = LdapUtils.newLdapName( "cn=john doe, ou=somecompany, c=SE"); DifferentSubtreeTempEntryRenamingStrategy tested = new DifferentSubtreeTempEntryRenamingStrategy( LdapUtils.newLdapName("ou=tempEntries")); int nextSequenceNo = tested.getNextSequenceNo(); Name result = tested.getTemporaryName(originalName); assertThat(result.toString()).isEqualTo("cn=john doe" + nextSequenceNo + ",ou=tempEntries"); }