【发布时间】:2012-05-24 05:02:01
【问题描述】:
使用 JMock:
context.checking(new Expectations() {{
// Other oneOf() will() statements ...
oneOf(shopAccount).enter(100, with(any(String.class)));
will(returnValue(true));
// Other oneOf() will() statements ...
}});
执行过程中会引发以下异常:
java.lang.IllegalArgumentException: 并非所有参数都给出了显式匹配器:要么所有参数都必须由匹配器指定,要么所有参数都必须由值指定,你不能混合匹配器和值。
为什么我不能这样做?使用with(any(Klass.class)) ?
【问题讨论】: