### Question:
Enum implements Serializable, Comparable<Enum<T>> { @SuppressWarnings("unchecked") public static <E extends Enum<?>> E valueOf(Class<? extends E> enumClass, Object key) { Validate.notNull(key); Entry<?> entry = getEntry(enumClass); Enum<?> value = null; if (entry != null) { value = entry.map.get(key); } Validate.isTrue(value != null, "Enum class %s does not have constant with key '%s'", ClassUtils.getShortClassName(enumClass), key.toString()); return (E) value; } 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 shouldBeEqual() { assertThat(ColorEnum.RED).isEqualTo(ColorEnum.RED); assertThat(ColorEnum.valueOf("Red")).isEqualTo(ColorEnum.RED); assertThat(ColorEnum.RED).isNotEqualTo(ColorEnum.BLUE); assertThat(GreekLetterEnum.ALPHA).isEqualTo(ExtendedGreekLetterEnum.ALPHA); assertThat(ExtendedGreekLetterEnum.valueOf("Alpha")).isEqualTo(GreekLetterEnum.ALPHA); assertThat(ExtendedGreekLetterEnum.GAMMA).isEqualTo(ExtendedGreekLetterEnum.GAMMA); assertThat(OperationEnum.PLUS).isEqualTo(OperationEnum.PLUS); assertThat(OperationEnum.valueOf("Minus")).isEqualTo(OperationEnum.MINUS); assertThat(OperationEnum.PLUS).isNotEqualTo(OperationEnum.MINUS); assertThat(ColorEnum.RED).isNotEqualTo(GreekLetterEnum.ALPHA); }
@Test void shouldHaveCorrectValueOf() { assertThat(ColorEnum.valueOf("Red")).isSameAs(ColorEnum.RED); assertThat(ColorEnum.valueOf("Blue")).isSameAs(ColorEnum.BLUE); assertThat(ColorEnum.valueOf("Green")).isSameAs(ColorEnum.GREEN); assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> ColorEnum.valueOf("Pink") ); assertThat(OperationEnum.valueOf("Plus")).isSameAs(OperationEnum.PLUS); assertThat(OperationEnum.valueOf("Minus")).isSameAs(OperationEnum.MINUS); assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> OperationEnum.valueOf("Multiply") ); assertThat(GreekLetterEnum.valueOf("Alpha")).isSameAs(GreekLetterEnum.ALPHA); assertThat(GreekLetterEnum.valueOf("Beta")).isSameAs(GreekLetterEnum.BETA); assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> GreekLetterEnum.valueOf("Gamma") ); assertThat(ExtendedGreekLetterEnum.valueOf("Alpha")).isSameAs(GreekLetterEnum.ALPHA); assertThat(ExtendedGreekLetterEnum.valueOf("Beta")).isSameAs(GreekLetterEnum.BETA); assertThat(ExtendedGreekLetterEnum.valueOf("Gamma")).isSameAs(ExtendedGreekLetterEnum.GAMMA); assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> ExtendedGreekLetterEnum.valueOf("Delta") ); }