PosCap implements Comparable<PosCap>, Serializable { @Override public int compareTo(PosCap o) { int result = partOfSpeech.compareTo(o.getPartOfSpeech()); if (result == 0) { result = Boolean.compare(capitalized, o.isCapitalized()); } return result; } 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 testCompareTo() { PosCap posCap = PosCap.create(PartOfSpeech.BOS, true); PosCap second = PosCap.getCapitalized(PartOfSpeech.BBS); assertEquals(posCap.compareTo(second), PartOfSpeech.BOS.compareTo(PartOfSpeech.BBS)); }