79523170

Date: 2025-03-20 13:59:47
Score: 2
Natty:
Report link

A simpler solution with idiomatic Spock: https://spockframework.org/spock/docs/2.3/all_in_one.html#_chaining_method_responses

serviceUnderTest.foo(serviceID1) >> "fine"
serviceUnderTest.foo(serviceID2) >> { throw new Exception() }

or you can even do this:

serviceUnderTest.foo(_) >> "fine" >> { throw new Exception() }
Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Enrico Sasdelli