WordPosCap implements Comparable<WordPosCap>, Serializable { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } WordPosCap that = (WordPosCap) o; if (!word.equals(that.word)) { return false; } if (!partOfSpeech.equals(that.partOfSpeech)) { return false; } return isCapitalized == that.isCapitalized; } WordPosCap(String word, PartOfSpeech partOfSpeech, boolean isCapitalized); String getWord(); PartOfSpeech getPartOfSpeech(); boolean isCapitalized(); PosCap toPosCap(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override int compareTo(WordPosCap o); @Override String toString();  }
@Test public void testEqualsSameObject() { WordPosCap wordPosCap = new WordPosCap("aWord", PartOfSpeech.NN, false); assertTrue(wordPosCap.equals(wordPosCap)); }
@Test public void testEqualsNull() { WordPosCap wordPosCap = new WordPosCap("aWord", PartOfSpeech.NN, false); assertFalse(wordPosCap.equals(null)); }
@Test public void testEqualsDifferentType() { WordPosCap wordPosCap = new WordPosCap("aWord", PartOfSpeech.NN, false); assertFalse(wordPosCap.equals("string")); }
@Test public void testEqualsDifferentWord() { WordPosCap first = new WordPosCap("aWord", PartOfSpeech.NN, false); WordPosCap second = new WordPosCap("word", PartOfSpeech.NN, false); assertFalse(first.equals(second)); }
@Test public void testEqualsDifferentPos() { WordPosCap first = new WordPosCap("aWord", PartOfSpeech.NN, false); WordPosCap second = new WordPosCap("aWord", PartOfSpeech.NNS, false); assertFalse(first.equals(second)); }
@Test public void testEqualsDifferentCapitalization() { WordPosCap first = new WordPosCap("aWord", PartOfSpeech.NN, false); WordPosCap second = new WordPosCap("aWord", PartOfSpeech.NN, true); assertFalse(first.equals(second)); }
@Test public void testEquals() { WordPosCap first = new WordPosCap("aWord", PartOfSpeech.NN, false); WordPosCap second = new WordPosCap("aWord", PartOfSpeech.NN, false); assertTrue(first.equals(second)); }