### Question:
RDN implements Comparable<RDN> { public RDN duplicate() { int numValues = attributeTypes.length; AttributeType[] newTypes = new AttributeType[numValues]; System.arraycopy(attributeTypes, 0, newTypes, 0, numValues); String[] newNames = new String[numValues]; System.arraycopy(attributeNames, 0, newNames, 0, numValues); ByteString[] newValues = new ByteString[numValues]; System.arraycopy(attributeValues, 0, newValues, 0, numValues); return new RDN(newTypes, newNames, newValues); } @SuppressWarnings("unchecked")  RDN(AttributeType attributeType, ByteString attributeValue); @SuppressWarnings("unchecked")  RDN(AttributeType attributeType, String attributeName, ByteString attributeValue); @SuppressWarnings("unchecked")  RDN(List<AttributeType> attributeTypes,
             List<String> attributeNames,
             List<ByteString> attributeValues); @SuppressWarnings("unchecked")  RDN(AttributeType[] attributeTypes, String[] attributeNames, ByteString[] attributeValues); static RDN create(AttributeType attributeType, ByteString attributeValue); int getNumValues(); boolean hasAttributeType(AttributeType attributeType); boolean hasAttributeType(String lowerName); AttributeType getAttributeType(int pos); String getAttributeName(int pos); ByteString getAttributeValue(AttributeType attributeType); ByteString getAttributeValue(int pos); boolean isMultiValued(); boolean hasValue(AttributeType type, ByteString value); static RDN decode(String rdnString); RDN duplicate(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); void toString(StringBuilder buffer); ByteStringBuilder toNormalizedByteString(ByteStringBuilder builder); @Override int compareTo(RDN rdn);  }### Answer:
@Test public void testDuplicateSingle() { RDN rdn1 = new RDN(AT_DC, AV_DC_ORG); RDN rdn2 = rdn1.duplicate(); assertNotSame(rdn1, rdn2); assertEquals(rdn1, rdn2); }
@Test public void testDuplicateMultiValued() { AttributeType[] types = new AttributeType[] { AT_DC, AT_CN }; String[] names = new String[] { "dc", "cn" }; ByteString[] values = new ByteString[] { AV_DC_ORG, AV_CN }; RDN rdn1 = new RDN(types, names, values); RDN rdn2 = rdn1.duplicate(); assertNotSame(rdn1, rdn2); assertEquals(rdn1, rdn2); }