### Question:
DN implements Comparable<DN>, Serializable { public DN rename(final DN fromDN, final DN toDN) { Reject.ifNull(fromDN, toDN); if (!isDescendantOf(fromDN)) { return this; } else if (equals(fromDN)) { return toDN; } else { final int sizeOfRdns = size() - fromDN.size(); RDN[] childRdns = new RDN[sizeOfRdns]; System.arraycopy(rdnComponents, 0, childRdns, 0, sizeOfRdns); return toDN.concat(childRdns); } } DN();  DN(RDN[] rdnComponents);  DN(List<RDN> rdnComponents);  DN(RDN rdn, DN parentDN); static DN rootDN(); boolean isRootDN(); int size(); RDN rdn(); DN rename(final DN fromDN, final DN toDN); RDN getRDN(int pos); DN parent(); DN getParentDNInSuffix(); DN child(RDN rdn); DN concat(RDN[] rdnComponents); DN child(DN relativeBaseDN); boolean isDescendantOf(DN dn); boolean isAncestorOf(DN dn); boolean matchesBaseAndScope(DN baseDN, SearchScope scope); static DN decode(ByteSequence dnString); static DN valueOf(String dnString); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); void toString(StringBuilder buffer); String toNormalizedUrlSafeString(); ByteString toNormalizedByteString(); @Override int compareTo(DN other); static final DN NULL_DN; static final byte NORMALIZED_RDN_SEPARATOR; static final byte NORMALIZED_AVA_SEPARATOR; static final byte NORMALIZED_ESC_BYTE; }### Answer:
@Test(dataProvider="renameData") public void testRename(String dnString, String fromDN, String toDN, String expectedDN) throws Exception { DN dn = DN.valueOf(dnString); DN renamed = dn.rename(DN.valueOf(fromDN), DN.valueOf(toDN)); assertThat(renamed).isEqualTo(DN.valueOf(expectedDN)); }