The Unit
return type makes things a bit trickier as you can't just chain:
returns "foo" thenThrows new RuntimeException
But you can still solve this problem if you use answers
like below:
mockedFoo.op(anyString) answers {args => } thenThrows new RuntimeException
See if this works for you.