Created
May 18, 2017 16:14
-
-
Save ondrej-kvasnovsky/a4497b3ec96c47971655a217971d0515 to your computer and use it in GitHub Desktop.
Automatically converts String to Enum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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