WordPos implements Comparable<WordPos>, Serializable { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } WordPos that = (WordPos) o; if (!word.equals(that.word)) { return false; } return tag == that.tag; } WordPos();  WordPos(String word, PartOfSpeech tag); WordPos forward(); String getWord(); void setWord(String word); PartOfSpeech getTag(); void setTag(PartOfSpeech tag); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override int compareTo(WordPos o); @Override String toString();  }
@Test public void testEqualsSameObject() { WordPos wordPos = new WordPos("aWord", PartOfSpeech.NN); assertTrue(wordPos.equals(wordPos)); }
@Test public void testEqualsNull() { WordPos wordPos = new WordPos("aWord", PartOfSpeech.NN); assertFalse(wordPos.equals(null)); }
@Test public void testEqualsDifferentType() { WordPos wordPos = new WordPos("aWord", PartOfSpeech.NN); assertFalse(wordPos.equals("string")); }
@Test public void testEqualsDifferentWord() { WordPos first = new WordPos("first", PartOfSpeech.NN); WordPos second = new WordPos("second", PartOfSpeech.NN); assertFalse(first.equals(second)); }
@Test public void testEqualsDifferentPos() { WordPos first = new WordPos("aWord", PartOfSpeech.NN); WordPos second = new WordPos("aWord", PartOfSpeech.NNS); assertFalse(first.equals(second)); }
@Test public void testEquals() { WordPos first = new WordPos("aWord", PartOfSpeech.NN); WordPos second = new WordPos("aWord", PartOfSpeech.NN); assertTrue(first.equals(second)); }