Skip to content

Instantly share code, notes, and snippets.

@michael-simons
Created July 3, 2019 07:13
Show Gist options
  • Save michael-simons/13b6f6b4504ee7e93d765ad7adb7715d to your computer and use it in GitHub Desktop.
Save michael-simons/13b6f6b4504ee7e93d765ad7adb7715d to your computer and use it in GitHub Desktop.
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
class EnumTests {
enum YourFriendlyEnumMostPeopleUse {
THING1, THING2
}
enum YesEnumsCanBeMuchMore {
THING1, THING2 {
@Override
public void something() {
}
};
void something() {}
}
@Test
void mindBlown() {
assertThat(YourFriendlyEnumMostPeopleUse.THING1.getClass().isEnum()).isTrue();
assertThat(YesEnumsCanBeMuchMore.THING1.getClass().isEnum()).isTrue();
assertThat(YesEnumsCanBeMuchMore.THING2.getClass().isEnum()).isFalse();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment