Expectations
我在测试用例中编写的块有问题:
new Expectations() {
{
mFindHandlerMock.findAll((Model) any, (Set<Id>) any, false);
if (!pWithRealData) {
result = Collections.emptySet();
} else {
result = pAllData;
}
times = 1;
Deencapsulation.invoke(mDb, "readSqlQuery", withAny(String.class));
result = "select * from realdata";
times = 1;
}
};
测试用例崩溃:
java.lang.IllegalArgumentException: Invalid conditional statement inside expectation block
正是在这里:
if (!pWithRealData) {
在这种情况下,这只是一个简单boolean
的问题。false
我完全不知道为什么exception
会发生这种情况。我已经用谷歌搜索过,但没有发现任何帮助。
你可以帮帮我吗?