我使用mockito
进行了测试verifies
如果调用Toast。
当我只运行我的班级测试时,IT工作。
Toast toast = mock(Toast.class);
verify(toast, times(1)).makeText(Robolectric.application, R.string.no_internet_connection, 1).show();
但是当我运行所有测试时,它会显示错误。我不明白为什么。 当我删除该行并运行测试时,Log不会向我显示任何错误。
控制台:
Missing method call for verify(mock) here:
-> at co.m.....(TestNetworkUtil.java:131)
Example of correct verification:
verify(mock).doSomething()
Also, this error might show up because you verify either of: final/private/equals()/hashCode() methods.
Those methods *cannot* be stubbed/verified.
org.mockito.exceptions.misusing.UnfinishedVerificationException:
Missing method call for verify(mock) here:
-> at co.m...