lundi 2 mai 2016

spock: verifying interaction using closures as a parameters

i want to write parameterized test that uses where: to verify if a method x was called. and i want to pass x as a parameter. something like

when:
someService.request(input)
then:
1 * (closure.call(otherService))
where
input | closure
1     | {OtherService service -> service.method1(2, 3)}
2     | {OtherService service -> service.method2(4, 5, 6)}

but i got an error:

Too few invocations for:

1 * (closure.call(otherService))   (0 invocations)

Unmatched invocations (ordered by similarity):

1 * otherService.deleteUserMessage(2,3)

is what i want to do possible?

Aucun commentaire:

Enregistrer un commentaire