Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.