Fragment { @Override public boolean equals(Object obj) { if (obj == null) { return false; } return toString().equals(obj.toString()); } 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 testEquals() { Fragment e1 = new Fragment(); e1.setWord("aktion"); e1.setMorpheme("s"); Fragment e2 = new Fragment(); e2.setWord("aktion"); e2.setMorpheme("s"); Assert.assertTrue(e1.equals(e1)); e2.setMorpheme(null); Assert.assertFalse(e1.equals(e2)); }