我注意到我的android测试用例有一个不寻常的行为,在类中有两个方法methodA()和methodB()当我模拟方法methodA()而不是模拟methodA()时它试图模拟methodB(并获得异常跟踪。为什么这种行为得以实现?跟踪类似于下面给出的
java.lang.IllegalStateException: missing behavior definition for the preceding method call:
CalledDAO.methodB({LastRequest=a.b.c.LastRequest@413d5ed8})
Usage is: expect(a.foo()).andXXX()
at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:42)
at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:85)
at $Proxy2.methodA(Native Method)
at a.b.c.SomeFragmentTest.testSimpleButtonClick1(SomeFragmentTest.java:501)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:545)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1574)
我正在研究方法A,但为什么要调用methodB ???