草庐IT

IsNonEmpty

全部标签

java - 当我将多个自定义匹配器分配给一个方法时,Mockito 的行为很奇怪

我想为一个方法使用两个自定义匹配器。基本上,如果我传递方法VALUE_A,我希望它返回RESULT_A,如果我传递它VALUE_B,我希望它返回RESULT_B。所以这是一段代码摘录:classIsNonEmptyextendsArgumentMatcher{publicbooleanmatches(Objectget){//Forsomereason,thismethodiscalledwhenIassigntheIsEmptymatchertoMockHtable.get()//Whenthishappens,thevalueofthegetargumentisnull,sothi