### Question:
DnsName implements CharSequence, Serializable, Comparable<DnsName> { public int size() { if (size < 0) { if (isRootLabel()) { size = 1; } else { size = ace.length() + 2; } } return size; } 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 sizeTest() { assertEquals(1, DnsName.from("").size()); assertEquals(13, DnsName.from("example.com").size()); assertEquals(16, DnsName.from("dömäin").size()); assertEquals(24, DnsName.from("dömäin.example").size()); }