9
我想這樣做:的Mockito Matchers.any(...)的一個參數只
verify(function, Mockito.times(1)).doSomething(argument1, Matchers.any(Argument2.class));
凡參數1是類型的specfic實例ARGUMENT1和參數2是任何實例類型參數2。
但我得到一個錯誤:
org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Invalid use of argument matchers! 2 matchers expected, 1 recorded. This exception may occur if matchers are combined with raw values:
//incorrect:
someMethod(anyObject(), "raw String"); When using matchers, all arguments have to be provided by matchers. For example:
//correct:
someMethod(anyObject(), eq("String by matcher"));
按照他的意見,我可以寫下面的,一切都很好:
verify(function, Mockito.times(1)).doSomething(Matchers.any(Argument1.class), Matchers.any(Argument2.class));
我在哪裏尋找類型的任何arguement ARGUMENT1和任何類型的參數參數2。
我該如何達到這個理想的行爲?
盯着我的臉,讓我無需花時間閱讀!感謝那。 –