1/* 2 * Copyright (c) 2007 Mockito contributors 3 * This program is made available under the terms of the MIT License. 4 */ 5package org.mockito; 6 7import java.lang.annotation.*; 8 9/** 10 * Allows shorthand {@link org.mockito.ArgumentCaptor} creation on fields. 11 * 12 * <p>Example: 13 * <pre class="code"><code class="java"> 14 * public class Test{ 15 * 16 * @Captor ArgumentCaptor<AsyncCallback<Foo>> captor; 17 * 18 * @Before 19 * public void init(){ 20 * MockitoAnnotations.initMocks(this); 21 * } 22 * 23 * @Test public void shouldDoSomethingUseful() { 24 * //... 25 * verify(mock.doStuff(captor.capture())); 26 * assertEquals("foo", captor.getValue()); 27 * } 28 * } 29 * </code></pre> 30 * 31 * <p> 32 * One of the advantages of using @Captor annotation is that you can avoid warnings related capturing complex generic types. 33 * 34 * @see ArgumentCaptor 35 * @since 1.8.3 36 */ 37@Retention(RetentionPolicy.RUNTIME) 38@Target(ElementType.FIELD) 39@Documented 40public @interface Captor {} 41