PosCap implements Comparable<PosCap>, Serializable { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PosCap that = (PosCap) o; if (capitalized != that.capitalized) { return false; } return partOfSpeech == that.partOfSpeech; } private  PosCap(PartOfSpeech partOfSpeech, boolean capitalized); static PosCap getCapitalized(PartOfSpeech partOfSpeech); static PosCap getNotCapitalized(PartOfSpeech partOfSpeech); static PosCap create(PartOfSpeech partOfSpeech, boolean capitalized); static int cardinality(); static PosCap createFromOrdinal(int ordinal); PartOfSpeech getPartOfSpeech(); boolean isCapitalized(); int ordinal(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override int compareTo(PosCap o); @Override String toString();  }
@Test public void testEquals() { PosCap posCap = PosCap.create(PartOfSpeech.BOS, true); PosCap second = PosCap.getCapitalized(PartOfSpeech.BOS); assertTrue(posCap.equals(second)); }