You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can mock "com.android.bluetooth.btservice.AdapterService" when i include "dexmaker-mockito"
But I want to mock final class (android.bluetooth.BluetoothDevice),
so i changed "dexmaker-mockito" to "dexmaker-mockito-inline".
Then runtime error is occurred like below.
09-09 14:18:59.808 E 16288 16310 MockMakerMultiplexer: Could not init mockmaker com.android.dx.mockito.inline.InlineStaticMockMaker
09-09 14:19:00.405 E 16288 16310 TestRunner: failed: test_final_mock(com.android.bluetooth.hfp.HeadsetAudioManagerTest)
09-09 14:19:00.405 E 16288 16310 TestRunner: ----- begin exception -----
09-09 14:19:00.405 E 16288 16310 TestRunner: org.objenesis.ObjenesisException: java.lang.UnsatisfiedLinkError: No implementation found for void com.android.bluetooth.btservice.AdapterService.classInitNative() (tried Java_com_android_bluetooth_btservice_AdapterService_classInitNative and Java_com_android_bluetooth_btservice_AdapterService_classInitNative__)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.objenesis.instantiator.sun.UnsafeFactoryInstantiator.newInstance(UnsafeFactoryInstantiator.java:76)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.mockito.internal.creation.instance.ObjenesisInstantiator.newInstance(ObjenesisInstantiator.java:19)
09-09 14:19:00.405 E 16288 16310 TestRunner: at com.android.dx.mockito.inline.InlineDexmakerMockMaker.createMock(InlineDexmakerMockMaker.java:306)
09-09 14:19:00.405 E 16288 16310 TestRunner: at com.android.dx.mockito.inline.MockMakerMultiplexer.createMock(MockMakerMultiplexer.java:65)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:35)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.mockito.internal.MockitoCore.mock(MockitoCore.java:69)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.mockito.Mockito.mock(Mockito.java:1905)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.mockito.Mockito.mock(Mockito.java:1814)
09-09 14:19:00.405 E 16288 16310 TestRunner: at com.android.bluetooth.hfp.HeadsetAudioManagerTest.test_final_mock(HeadsetAudioManagerTest.java:44)
09-09 14:19:00.405 E 16288 16310 TestRunner: at java.lang.reflect.Method.invoke(Native Method)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:52)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
09-09 14:19:00.405 E 16288 16310 TestRunner: at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
09-09 14:19:00.405 E 16288 16310 TestRunner: at androidx.test.internal.runner.junit4.statement.RunAfters.evaluate(RunAfters.java:61)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
09-09 14:19:00.405 E 16288 16310 TestRunner: at androidx.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:104)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.Suite.runChild(Suite.java:128)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.Suite.runChild(Suite.java:27)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
09-09 14:19:00.405 E 16288 16310 TestRunner: at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
09-09 14:19:00.405 E 16288 16310 TestRunner: at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
09-09 14:19:00.405 E 16288 16310 TestRunner: at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2218)
09-09 14:19:00.405 E 16288 16310 TestRunner: Caused by: java.lang.UnsatisfiedLinkError: No implementation found for void com.android.bluetooth.btservice.AdapterService.classInitNative() (tried Java_com_android_bluetooth_btservice_AdapterService_classInitNative and Java_com_android_bluetooth_btservice_AdapterService_classInitNative__)
09-09 14:19:00.405 E 16288 16310 TestRunner: at com.android.bluetooth.btservice.AdapterService.classInitNative(Native Method)
09-09 14:19:00.405 E 16288 16310 TestRunner: at com.android.bluetooth.btservice.AdapterService.(AdapterService.java:347)
09-09 14:19:00.405 E 16288 16310 TestRunner: at sun.misc.Unsafe.allocateInstance(Native Method)
09-09 14:19:00.405 E 16288 16310 TestRunner: at java.lang.reflect.Method.invoke(Native Method)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.objenesis.instantiator.sun.UnsafeFactoryInstantiator.newInstance(UnsafeFactoryInstantiator.java:74)
09-09 14:19:00.405 E 16288 16310 TestRunner: ... 39 more
09-09 14:19:00.406 E 16288 16310 TestRunner: ----- end exception -----
I can't understand why "dexmaker-mockito" has no problem, but "dexmaker-mockito-inline" has upper problem.
There is some difference about mocking native method?
Thank you.
The text was updated successfully, but these errors were encountered:
I can mock "com.android.bluetooth.btservice.AdapterService" when i include "dexmaker-mockito"
But I want to mock final class (android.bluetooth.BluetoothDevice),
so i changed "dexmaker-mockito" to "dexmaker-mockito-inline".
Then runtime error is occurred like below.
09-09 14:18:59.808 E 16288 16310 MockMakerMultiplexer: Could not init mockmaker com.android.dx.mockito.inline.InlineStaticMockMaker
09-09 14:19:00.405 E 16288 16310 TestRunner: failed: test_final_mock(com.android.bluetooth.hfp.HeadsetAudioManagerTest)
09-09 14:19:00.405 E 16288 16310 TestRunner: ----- begin exception -----
09-09 14:19:00.405 E 16288 16310 TestRunner: org.objenesis.ObjenesisException: java.lang.UnsatisfiedLinkError: No implementation found for void com.android.bluetooth.btservice.AdapterService.classInitNative() (tried Java_com_android_bluetooth_btservice_AdapterService_classInitNative and Java_com_android_bluetooth_btservice_AdapterService_classInitNative__)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.objenesis.instantiator.sun.UnsafeFactoryInstantiator.newInstance(UnsafeFactoryInstantiator.java:76)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.mockito.internal.creation.instance.ObjenesisInstantiator.newInstance(ObjenesisInstantiator.java:19)
09-09 14:19:00.405 E 16288 16310 TestRunner: at com.android.dx.mockito.inline.InlineDexmakerMockMaker.createMock(InlineDexmakerMockMaker.java:306)
09-09 14:19:00.405 E 16288 16310 TestRunner: at com.android.dx.mockito.inline.MockMakerMultiplexer.createMock(MockMakerMultiplexer.java:65)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:35)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.mockito.internal.MockitoCore.mock(MockitoCore.java:69)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.mockito.Mockito.mock(Mockito.java:1905)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.mockito.Mockito.mock(Mockito.java:1814)
09-09 14:19:00.405 E 16288 16310 TestRunner: at com.android.bluetooth.hfp.HeadsetAudioManagerTest.test_final_mock(HeadsetAudioManagerTest.java:44)
09-09 14:19:00.405 E 16288 16310 TestRunner: at java.lang.reflect.Method.invoke(Native Method)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:52)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
09-09 14:19:00.405 E 16288 16310 TestRunner: at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
09-09 14:19:00.405 E 16288 16310 TestRunner: at androidx.test.internal.runner.junit4.statement.RunAfters.evaluate(RunAfters.java:61)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
09-09 14:19:00.405 E 16288 16310 TestRunner: at androidx.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:104)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.Suite.runChild(Suite.java:128)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.Suite.runChild(Suite.java:27)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
09-09 14:19:00.405 E 16288 16310 TestRunner: at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
09-09 14:19:00.405 E 16288 16310 TestRunner: at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
09-09 14:19:00.405 E 16288 16310 TestRunner: at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2218)
09-09 14:19:00.405 E 16288 16310 TestRunner: Caused by: java.lang.UnsatisfiedLinkError: No implementation found for void com.android.bluetooth.btservice.AdapterService.classInitNative() (tried Java_com_android_bluetooth_btservice_AdapterService_classInitNative and Java_com_android_bluetooth_btservice_AdapterService_classInitNative__)
09-09 14:19:00.405 E 16288 16310 TestRunner: at com.android.bluetooth.btservice.AdapterService.classInitNative(Native Method)
09-09 14:19:00.405 E 16288 16310 TestRunner: at com.android.bluetooth.btservice.AdapterService.(AdapterService.java:347)
09-09 14:19:00.405 E 16288 16310 TestRunner: at sun.misc.Unsafe.allocateInstance(Native Method)
09-09 14:19:00.405 E 16288 16310 TestRunner: at java.lang.reflect.Method.invoke(Native Method)
09-09 14:19:00.405 E 16288 16310 TestRunner: at org.objenesis.instantiator.sun.UnsafeFactoryInstantiator.newInstance(UnsafeFactoryInstantiator.java:74)
09-09 14:19:00.405 E 16288 16310 TestRunner: ... 39 more
09-09 14:19:00.406 E 16288 16310 TestRunner: ----- end exception -----
AdapterService class code is below.
package com.android.bluetooth.btservice;
public class AdapterService extends Service {
...
}
I can't understand why "dexmaker-mockito" has no problem, but "dexmaker-mockito-inline" has upper problem.
There is some difference about mocking native method?
Thank you.
The text was updated successfully, but these errors were encountered: