2
什麼是正確匹配的Mockito在此方法簽名的第二個參數:匹配器的Mockito整數...參數
List<Something> findSomething(Object o, Integer... ids);
我嘗試了以下的匹配:
when(findSomething(any(), anyInt())).thenReturn(listOfSomething);
when(findSomething(any(), any())).thenReturn(listOfSomething);
,但被的Mockito沒有創造代理我,退回List
是空的。
這導致一個編譯器錯誤: 的方法SomethingService類型中的findSomething(Object,Integer ...)不適用於參數(Object,Matcher) –
w33z33