Mockito: Verifying with generic parameters

后端 未结 4 1024
北海茫月
北海茫月 2020-12-02 19:34

With Mockito I can do the following:

verify(someService).process(any(Person.class));

But how do I write this if process takes

4条回答
  •  攒了一身酷
    2020-12-02 20:34

    Try:

    verify(someService).process(Matchers.>any());
    

    Actually, IntelliJ automatically suggested this fix when I typed any()... Unfortunately you cannot use static import in this case.

提交回复
热议问题