Hi,
First off, I'm guessing that you're using String as an example or proof of concept. But as a final class, it's not mockable. That's why it's throwing up this exception here.
I made some major recent changes to how sdk classes are mocked and it seems to have caused this exception to be thrown before the check-and-warn code.
Second, from your error output I see that you haven't added the frameworks mock jar file to your annotation processor factory path. This is a new step that I haven't had the chance to add to the instructions yet. There is an email on the discussion group related to this with a title similar to "New Android Mock".
In summary, you need to do the same process as you did for ANDROID_JAR (or similar), the (Annotations -> Factory Path) variable you added during setup to point to the android ask jar file. Create another one with a name like ANDROID_FRAMEWORK_MOCKS and point that at the file "android_framework_mocks.jar" which is in the bin folder of your android mock install folder.
Third, if you're seeing a ClassNotFound on your own classes, it might be that you're mocking a class that references a class in a Referenced Library. Android Test projects cannot see the contents of any Android project referenced libraries. Even if you're not mocking a jar from inside such a jar, if the class being mocked has a method whose signature refers to such a class, you'll have trouble.
Check the stack trace to see which class is not found then add the jar containing that class to the build path of your test project.
NOTE: to be clear this is not the factory path of step 2. This is your normal test project's Referenced Libraries.
If those steps don't sort out the problems let me know. I'm not sure why you would see this same stack trace with your own classes except in the case I described in step 3. But if you're still having trouble let me know and send me the stack trace and I'll see what I can figure out.
Thanks,
Steve
Do you know which jar contains com.google.gain.Gson? I suspect it isn't android.jar. It sounds like a Google Api. You'll want to make sure it's in the factory classpath for the test project in the same way as you have android.jar (ANDROID_RUNTIME).
Command line is no problem. Add android.jar to your classpath. Same for the mock generator jar.
That's very odd. A couple of questions.
1. are you really trying to mock java.lang.Object? You should be able to but there's no reason to do so except to test Android mock.
2. It found the framework mocks jar (see 12:05:02 pm logs). Does the jar contain a class called v15.genmocks.java.lang.ObjectDelegateInterface?
That's very odd. A couple of questions.
1. are you really trying to mock java.lang.Object? You should be able to but there's no reason to do so except to test Android mock.
2. It found the framework mocks jar (see 12:05:02 pm logs). Does the jar contain a class called v15.genmocks.java.lang.ObjectDelegateInterface?
If you can subclass it you can mock it.
Try quitting and restarting eclipse to drop the Object mocking. It caches a lot of stale info.
The error is very strange especially at Processing time. I'll need to think about it a while. But note that static and final methods can't be mocked so you might not get much benefit from mocking Content Resolver anyhow... the ask provided stub (called mock) should be a good workaround.