### Question:
DnsName implements CharSequence, Serializable, Comparable<DnsName> { public static DnsName from(CharSequence name) { return from(name.toString()); } private  DnsName(String name); private  DnsName(String name, boolean inAce); private  DnsName(DnsLabel[] rawLabels, boolean validateMaxDnsnameLength); void writeToStream(OutputStream os); byte[] getBytes(); byte[] getRawBytes(); String getRawAce(); String asIdn(); String getDomainpart(); String getHostpart(); DnsLabel getHostpartLabel(); int size(); @Override int length(); @Override char charAt(int index); @Override CharSequence subSequence(int start, int end); @Override String toString(); static DnsName from(CharSequence name); static DnsName from(String name); static DnsName from(DnsName child, DnsName parent); static DnsName from(DnsLabel child, DnsName parent); static DnsName from(DnsLabel grandchild, DnsLabel child, DnsName parent); static DnsName from(DnsName... nameComponents); static DnsName from(String[] parts); static DnsName parse(DataInputStream dis, byte[] data); @Override int compareTo(DnsName other); @Override boolean equals(Object other); @Override int hashCode(); boolean isDirectChildOf(DnsName parent); boolean isChildOf(DnsName parent); int getLabelCount(); DnsLabel[] getLabels(); DnsLabel getLabel(int labelNum); DnsLabel[] getRawLabels(); DnsName stripToLabels(int labelCount); DnsName getParent(); boolean isRootLabel(); static final int MAX_LABELS; static final DnsName ROOT; static final DnsName IN_ADDR_ARPA; static final DnsName IP6_ARPA; static boolean VALIDATE; final String ace; }### Answer:
@Test public void testConcact() { String leftString = "foo.bar.de"; String rightString = "example.org"; DnsName left = DnsName.from(leftString); DnsName right = DnsName.from(rightString); DnsName concated = DnsName.from(left, right); DnsName expected = DnsName.from(leftString + '.' + rightString); assertEquals(expected, concated); }
@Test public void caseInsenstiveCompare() { DnsName lowercase = DnsName.from("cs.fau.de"); DnsName uppercase = DnsName.from("CS.fau.de"); assertEquals(lowercase, uppercase); }
@Test public void trailingDotDnsNameFromTest() { final String trailingDotDnsName = "foo.bar."; DnsName dnsName = DnsName.from(trailingDotDnsName); assertEquals("foo.bar", dnsName.ace); }