scala - How to verify a method is called N times exactly in specs2? -
In specs2, I can confirm the time of invocation of a method:
There was a (user) .getName there were two (user). Gate name there were three (user). GetName But how to check n times? Something looks like:
There were times (n, user) .getName Unfortunately there is no such API < / Div>
If you see the implementation of specs2 bindings for duplication, you will get something like
< Code> Diff A [T & LT: AIFF] (Fake: T) (Vertical Aoder: Option [inorder] = Inorder ()): T = Czech (Fake, Org. Mokito, Mokitō. Times (1)) (Aodder) So I think that Only define your own bar method by copying that one: def times [t: lt;: any reef] (n: IT , Fake: T) (Vertical AoOder: Option [Inorder] = Inorder ()): T = Check (Fake, Org. Mokito, Mokitō. Times (N)) (An order) Or simply use the mapit:
Val mocker = new MockitoMocker {} Verify (user, org.mockito.Mockito.times (42)). GetName
Comments
Post a Comment