Spock throw exception test May 10, 2023 by Tarik I believe your then block needs to be fixed. Try the following syntax: then: thrown CustomException