可以使用@Captor注释避免嵌套的泛型问题:
public class Test{ @Mock private Service service; @Captor private ArgumentCaptor<ArrayList<SomeType>> captor; @Before public void init(){ MockitoAnnotations.initMocks(this); } @Test public void shouldDoStuffWithListValues() { //... verify(service).doStuff(captor.capture())); }}


