loose2200 / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

Argument Captor argument is not correct in the documentation. #502

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The hamcrest matcher, argument order is "actual" then "expected" but  the 
argument captor document is reversed.  Please see the documentation.  
http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html#15

The expected is argumentCaptor first the expected next.  Please see the third 
line in the below code snippet.

ArgumentCaptor argument = ArgumentCaptor.forClass(Person.class); verify(mock).doSomething(argument.capture()); assertEquals(argument.getValue().getName(), "John");


This is not an issue, just a small enhancement.

Thanks,
-Kuppa

Original issue reported on code.google.com by sridhara...@gmail.com on 13 Sep 2014 at 5:58

GoogleCodeExporter commented 8 years ago
It depends. In TestNG assertEquals has arguments inverted :).

Original comment by msz...@wp.pl on 13 Sep 2014 at 6:40

GoogleCodeExporter commented 8 years ago
I am sorry, I was mixed with my test case. It depends on the testNG and I 
agree. I had similar code and I used 

`
assertThat(argument.getValue().getName(), "John");
`

Please consider this ticket as not a bug and close it.

Thanks,
-Kuppa

Original comment by sridhara...@gmail.com on 13 Sep 2014 at 6:56