DecompoundedWord implements Comparable<DecompoundedWord> { @Override public boolean equals(Object obj) { if (obj == null) { return false; } return toString().equals(obj.toString()); }  static DecompoundedWord createFromString(String aSplit); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); void appendSplitElement(Fragment aSplit); void prependSplitElement(Fragment aSplit); List<Fragment> getSplits(); void setSplits(List<Fragment> aSplits); void addAll(List<Fragment> aSplits); void replaceSplitElement(int aIndex, DecompoundedWord aSplit); void replaceSplitElement(int aIndex, Fragment aSplitElement); boolean equalWithoutMorpheme(DecompoundedWord aOtherSplit); String getWord(); DecompoundedWord createCopy(); double getWeight(); void setWeight(double aWeight); @Override int compareTo(DecompoundedWord aOtherSplit); void setSplitPos(int aSplitPos); int getSplitPos(); boolean isCompound(); boolean hasLastFragmentMorpheme();  }
@Test public void testEquals() { Fragment e1 = new Fragment(); e1.setWord("aktion"); e1.setMorpheme("s"); Fragment e2 = new Fragment(); e2.setWord("plan"); DecompoundedWord s1 = new DecompoundedWord(); s1.appendSplitElement(e1); s1.appendSplitElement(e2); Fragment e3 = new Fragment(); e3.setWord("aktion"); e3.setMorpheme("s"); Fragment e4 = new Fragment(); e4.setWord("plan"); DecompoundedWord s2 = new DecompoundedWord(); s2.appendSplitElement(e3); s2.appendSplitElement(e4); assertTrue(s1.equals(s2)); e2.setMorpheme("e"); assertFalse(s1.equals(s2)); }