Description of unmatched invocations is blurry
GoogleCodeExporter opened this issue · comments
Google Code Exporter commented
It would be awesome to see which invocation has not been matched.
Lack of knowledge which exact invocation was not matched.
When having such a block of code in Spock spec:
then:
1 * repository.persist({Something something ->
something.getAccount() == 12
something.getAmount() == 10
something.getLoan() == 123
something.getClientId() == 1234
})
when not matching for example getLoan() I receive such output:
Too few invocations for:
1 * repository.persist({Something something ->
something.getAccount() == 12
something.getAmount() == 10
something.getLoan() == 123
something.getClientId() == 1234
}) (0 invocations)
Unmatched invocations (ordered by similarity):
1 * repository.persist(Something[some toString() output])
Original issue reported on code.google.com by marcin.g...@gmail.com
on 7 Nov 2014 at 1:13
Google Code Exporter commented
Are you saying that you want to have more information on *why* a particular
invocation didn't match? You can get that by rewriting to `1 *
repository.persist(_) >> { assert ... }`, although the semantics aren't
completely the same.
PS: The interaction in your example won't work as intended. An argument
constraint is a single boolean expression, i.e. you'll need to connect all
equals comparisons via `&&`.
Original comment by pnied...@gmail.com
on 7 Nov 2014 at 1:22
Google Code Exporter commented
Ok, you're right - thx for the update!
Original comment by marcin.g...@gmail.com
on 8 Nov 2014 at 8:24