Skip to content

Commit

Permalink
documented the use of argThat. fixes #240
Browse files Browse the repository at this point in the history
  • Loading branch information
etorreborre committed Mar 10, 2014
1 parent d956b1b commit fcb1f46
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions guide/src/test/scala/org/specs2/guide/Matchers.scala
Expand Up @@ -500,6 +500,10 @@ m.get(999) must_== "element"
m.get(===(123)) returns "one"
}}

**Note** the call above works because there is an implicit method `argThat` which transforms a specs2 `Matcher[T]` into a Hamcrest one and in turn call Mockito's `org.mockito.Matchers.argThat` method to register the Hamcrest matcher. However [sometimes](https://groups.google.com/forum/#!msg/specs2-users/_slOZQoICzU/DF-ZQCq_GmkJ) the implicit conversion is not called and you have to explicitly call the `argThat` method like so: ${snippet{
m.get(argThat(===(123))) returns "one"
}}

##### Callbacks

In some rare cases, it is necessary to have the return value depend on the parameters passed to the mocked method: ${snippet{
Expand Down

0 comments on commit fcb1f46

Please sign in to comment.