Fragment { @Override public String toString() { String s = word; if (morpheme != null) { s += "(" + morpheme + ")"; } return s; } Fragment();  Fragment(String aWord);  Fragment(String aWord, String aMorpheme); static Fragment createFromString(String aElement); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); String getWord(); String getWordWithMorpheme(); void setWord(String aWord); String getMorpheme(); boolean hasMorpheme(); void setMorpheme(String aMorpheme); String toStringWithoutMorpheme(); boolean shouldSplitAgain(); void setSplitAgain(boolean aSplitAgain);  }
@Test public void testToString() { Fragment e = new Fragment(); e.setWord("aktion"); e.setMorpheme("s"); Assert.assertEquals("aktion(s)", e.toString()); e.setMorpheme(null); Assert.assertEquals("aktion", e.toString()); }