0
JMockit
不返回Integer
設置爲期望返回值。jmockit問題當模擬類包含方法返回整數
public interface Foo {
Integer getInt();
}
@Test
public void test(@Mocked final Foo foo) {
final Integer anyInt = 3;
new Expectations() {{
foo.getInt(); result = anyInt;
}};
assertThat(foo.getInt(), equalTo(anyInt));
}
失敗消息:
java.lang.AssertionError:
Expected: <3>
but: was <0>
任何想法,爲什麼?
JMockit 1.14
由於
大聲笑,非常感謝! – beluchin 2015-03-05 14:11:46