Hi,
I followed the instructions contained in that pdf (and also found the discussion noting that it was out of date). I have tried to set this up several times from scratch and i see the same issue over and over again. There are two problems:
1. Android-mock doesn't seem to know about the classes defined by the application under test if you specify the bin directory. (Turns out the instructions are wrong and if you set a factory path pointing to AppUnderTest/bin/classes this works)
2. When i actually deploy the tests, I fail to load the mocks that I have generated (the instructions for setting it up in eclipse mention downloading the AndroidMockRuntime, but never actually use include it in the apk). I have tried setting the AndroidRuntime, and the AndroidGenerator as exported and I see the same result for both custom objects and android objects.
Example stack trace:
java.lang.RuntimeException: Could not find mock for java.lang.Object -- Make sure to run the MockGenerator.jar on your test jar, and to build the Android test APK using the modified jar created by MockGenerator
at com.google.android.testing.mocking.AndroidMock.getInterfaceFor(AndroidMock.java:2790)
at com.google.android.testing.mocking.AndroidMock.createMock(AndroidMock.java:187)
at com.google.android.testing.mocking.AndroidMock.createMock(AndroidMock.java:157)
at com.abudker.dexit.eclair.test.DexTest.doAObjectTest(DexTest.java:19)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:537)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)
Caused by: java.lang.ClassNotFoundException: genmocks.java.lang.ObjectDelegateInterface
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:217)
at java.lang.Class.forName(Class.java:172)
at com.google.android.testing.mocking.AndroidMock.getInterfaceFor(AndroidMock.java:2788)
... 15 more
Caused by: java.lang.NoClassDefFoundError: genmocks/java/lang/ObjectDelegateInterface
... 19 more
Caused by: java.lang.ClassNotFoundException: genmocks.java.lang.ObjectDelegateInterface
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
... 19 more