Skip to content

Test failing with the expected thrown exception #1350

Answered by leonard84
spartanhooah asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @spartanhooah,

this kind of question is more suited for Spock on Stackoverflow.

However, you actually just gave the answer already.

The repository constructs a Baz object by passing a Clob to Baz's constructor, which then pulls out the string contents of the Clob.

And the stacktrace is the next hint:

	at com.company.Baz.<init>(Baz.java:17)
	at com.company.ServiceTest.when Baz throws SQL exception(ServiceTest.groovy:50)

So you don't see a reference to testSubject.doFoo(headerId) as it already fails in your given block when calling def baz = new Baz(clob).
As you didn't actually include a MCVE I can only guess if that fixes your problem. If you read the section about exception conditions

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@spartanhooah
Comment options

@leonard84
Comment options

Answer selected by spartanhooah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants