Search code examples
groovyspock

What is the definition of double right arrow operator ( >> ) in Spock?


There are code snippets in this Spock wiki page that involve double right arrow operators (>>). For example:

setup:
subscriber.isAlive() >> true

So, what does the >> operator mean in this case? Thank you very much.


Solution

  • The right-shift (>>) operator defines the return value or behavior of a stubbed method. You can find more information under Stubbing in the reference documentation.