Skip to content

Instantly share code, notes, and snippets.

@ondrej-kvasnovsky
Created May 18, 2017 16:14
Show Gist options
  • Save ondrej-kvasnovsky/a4497b3ec96c47971655a217971d0515 to your computer and use it in GitHub Desktop.
Save ondrej-kvasnovsky/a4497b3ec96c47971655a217971d0515 to your computer and use it in GitHub Desktop.
Automatically converts String to Enum
enum State {
A, B, C
}
class Test {
State a() {
"A"
}
}
def "Automatically converts String to Enum"() {
when:
String x = "A"
then:
x as State == State.A
new Test().a() == State.A
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment