|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value=FIELD) @Documented public @interface Captor
Allows shorthand ArgumentCaptor
creation on fields.
Example:
public class Test{
@Captor ArgumentCaptor<AsyncCallback<Foo>> captor;
@Before
public void init(){
MockitoAnnotations.initMocks(this);
}
@Test public void shouldDoSomethingUseful() {
//...
verify(mock.doStuff(captor.capture()));
assertEquals("foo", captor.getValue());
}
}
One of the advantages of using @Captor annotation is that you can avoid warnings related capturing complex generic types.
ArgumentCaptor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |