### Question:
Enum implements Serializable, Comparable<Enum<T>> { @Override public int compareTo(Enum<T> o) { if (o == this) { return 0; } if (o.getClass() != this.getClass()) { throw new ClassCastException(this.getClass() + " cannot be compared to " + o.getClass()); } return key.compareTo(o.key); } protected  Enum(T key); @SuppressWarnings("unchecked") static E valueOf(Class<? extends E> enumClass, Object key); @SuppressWarnings("unchecked") static List<E> values(Class<? extends E> enumClass); @JsonValue final T getKey(); @SuppressWarnings("unchecked") Class<? extends Enum<T>> getEnumClass(); @Override int compareTo(Enum<T> o); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test void testCompareTo() { assertThat(ColorEnum.BLUE.compareTo(ColorEnum.BLUE)).isEqualTo(0); assertThat(ColorEnum.RED.compareTo(ColorEnum.BLUE)).isGreaterThan(0); assertThat(ColorEnum.BLUE.compareTo(ColorEnum.RED)).isLessThan(0); assertThatExceptionOfType(NullPointerException.class).isThrownBy(() -> ColorEnum.RED.compareTo(null) ); assertThatExceptionOfType(ClassCastException.class).isThrownBy(() -> ColorEnum.RED.compareTo(GreekLetterEnum.ALPHA) ); }