SplitIndex { @Override public String toString() { return new StringBuffer() .append("(") .append(Splitter.class.getName()) .append(": index=") .append(index) .append(", last=") .append(last) .append(")").toString(); } private  SplitIndex(int index, boolean last); static SplitIndex valueOf(int index, boolean last); int getIndex(); boolean isLast(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testToString() { SplitIndex index = SplitIndex.valueOf(14, true); String str = index.toString(); assertTrue("Class name missing", str.contains(Splitter.class.getName())); assertTrue("index missing", str.contains("14")); assertTrue("last flag missing", str.contains("true")); }