kokalsuhas / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

Could not find java.beans.Introspector.getBeanInfo, referenced from org.mockito.cglib.core.ReflectUtils.getPropertiesHelper #464

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This is occurring on an android unit test project running from the Android ADK.

What steps will reproduce the problem?
1. Integrated the following into my project's libs folder.
mockito-all-1.9.5.jar
dexmaker-1.0.jar
dexmaker-mockito-1.0.jar

in a test method, I call:
Places placesAPI = (Places) org.mockito.Mockito.mock(Places.class);

What is the expected output? What do you see instead?
I expect the instantiation of the mock object to be successful.

What version of the product are you using? On what operating system?
1.9.5 on Windows 8.

Please provide any additional information below.
Eclipse from the Android 4.4 ADK.
This is a multi-project workspace.
Tried on Android 4.3 and Android 4.4 devices. Same outcome both devices.

I am integrating the 3 jar files above in my test project, not in the code 
implementation project.
When I hit the line of code included above, the following error is seen in 
Logcat. 
"Could not find java.beans.Introspector.getBeanInfo, referenced from 
org.mockito.cglib.core.ReflectUtils.getPropertiesHelper"

Lastly I see this call stack:
12-03 08:24:47.050: I/TestRunner(5696): ----- begin exception -----
12-03 08:24:47.070: D/dalvikvm(5696): GC_FOR_ALLOC freed 337K, 3% free 
16514K/16888K, paused 10ms, total 10ms
12-03 08:24:47.080: I/TestRunner(5696): java.lang.VerifyError: 
org/mockito/cglib/core/ReflectUtils
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:167)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrateg
y.java:25)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java
:217)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:117)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:109)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:105)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.cglib.proxy.Enhancer.<clinit>(Enhancer.java:70)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass(ClassImpo
sterizer.java:85)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposteri
zer.java:62)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposteri
zer.java:56)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.internal.creation.CglibMockMaker.createMock(CglibMockMaker.java:23)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.internal.util.MockUtil.createMock(MockUtil.java:26)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.internal.MockitoCore.mock(MockitoCore.java:51)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.Mockito.mock(Mockito.java:1243)
12-03 08:24:47.080: I/TestRunner(5696):     at 
org.mockito.Mockito.mock(Mockito.java:1120)
12-03 08:24:47.080: I/TestRunner(5696):     at 
com.foo.app.test.placedetails.unit.AndroidTestCase.testXXXMyApi(AndroidTestCase.
java:39)
12-03 08:24:47.080: I/TestRunner(5696):     at 
java.lang.reflect.Method.invokeNative(Native Method)
12-03 08:24:47.080: I/TestRunner(5696):     at 
java.lang.reflect.Method.invoke(Method.java:515)
12-03 08:24:47.080: I/TestRunner(5696):     at 
junit.framework.TestCase.runTest(TestCase.java:168)
12-03 08:24:47.080: I/TestRunner(5696):     at 
junit.framework.TestCase.runBare(TestCase.java:134)
12-03 08:24:47.080: I/TestRunner(5696):     at 
junit.framework.TestResult$1.protect(TestResult.java:115)
12-03 08:24:47.080: I/TestRunner(5696):     at 
junit.framework.TestResult.runProtected(TestResult.java:133)
12-03 08:24:47.080: I/TestRunner(5696):     at 
junit.framework.TestResult.run(TestResult.java:118)
12-03 08:24:47.080: I/TestRunner(5696):     at 
junit.framework.TestCase.run(TestCase.java:124)
12-03 08:24:47.080: I/TestRunner(5696):     at 
android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
12-03 08:24:47.080: I/TestRunner(5696):     at 
android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
12-03 08:24:47.080: I/TestRunner(5696):     at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:55
4)
12-03 08:24:47.080: I/TestRunner(5696):     at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)

Original issue reported on code.google.com by mikel...@gmail.com on 3 Dec 2013 at 1:28

GoogleCodeExporter commented 8 years ago
Hi think you should see with the Android guys. I'm not sure how the Android 
Development Kit works or the APIs, but CGLIB is using the stand JDK, so they 
may have removed the java.beans.* api. Maybe the dexmaker guys can help.

Original comment by brice.du...@gmail.com on 4 Dec 2013 at 2:34

GoogleCodeExporter commented 8 years ago
I get same sort of error but with PowerMock. Here's the log output.

It crashes on this line: PackageManager spyPackMan = 
spy(activity.getPackageManager());

java.lang.VerifyError: org/mockito/cglib/core/ReflectUtils
at 
org.mockito.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:167)
at 
org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrateg
y.java:25)
at 
org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java
:217)
at org.mockito.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:117)
at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:109)
at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:105)
at org.mockito.cglib.proxy.Enhancer.<clinit>(Enhancer.java:70)
at 
org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass(ClassImpo
sterizer.java:85)
at 
org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposteri
zer.java:62)
at 
org.powermock.api.mockito.internal.mockcreation.MockCreator.createMethodInvocati
onControl(MockCreator.java:111)
at 
org.powermock.api.mockito.internal.mockcreation.MockCreator.mock(MockCreator.jav
a:60)
at org.powermock.api.mockito.PowerMockito.spy(PowerMockito.java:220)
at com.myapp.test.mock.MockFactory.stubPackageManager(MockFactory.java:33)
at com.myapp.test.mock.MockFactory.createStubs(MockFactory.java:21)
at com.myapp.test.MyActivityUnitTest.setUp(MyActivityUnitTest.java:38)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:55
4)
at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1738)

Not sure what happens but tried a lot of thing which haven't changed anything...

Original comment by vbo...@gmail.com on 23 Dec 2013 at 4:32

GoogleCodeExporter commented 8 years ago
Hi, Powermock is yet another project, and I don't think Johan made Powermock 
compatible with Dalvik. I don't know if he will.

Original comment by brice.du...@gmail.com on 24 Dec 2013 at 11:59