Use of When and Then in Groovy?
-
09-03-2021 - |
문제
I have been seeing the use of "when" and "then" keyword in Groovy in several Groovy articles. One of them is here. I searched for the Groovy Doc's but I couldn't find it. So whats the actual purposes of these keyword's? Similar to if/then?
다른 팁
when
and then
, among others, seem to be documented here.
Technically the then, when and a few other constructs in Spock are good old labels (aka goto), which developers rarely use these days. Spock uses them to allow developers to logically and visually separate different aspects of their tests - assumptions, constraints, statements or data. The Spock compile-time AST transformations than use the labels to understand the structure of the test and do its magic.
제휴하지 않습니다 StackOverflow