### Question:
RDN implements Comparable<RDN> { @Override public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append(attributeNames[0]); buffer.append("="); buffer.append(getDNValue(attributeValues[0])); for (int i = 1; i < attributeTypes.length; i++) { buffer.append("+"); buffer.append(attributeNames[i]); buffer.append("="); buffer.append(getDNValue(attributeValues[i])); } return buffer.toString(); } @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 testEscaping() { RDN rdn = new RDN(AT_DC, ByteString.valueOfUtf8(" ")); assertEquals(rdn.toString(), "dc=\\ "); }
@Test(dataProvider = "testRDNs") public void testToString(String rawRDN, String normRDN, String stringRDN) throws Exception { RDN rdn = RDN.decode(rawRDN); assertEquals(rdn.toString(), stringRDN); }