linkedin / dexmaker

A utility for doing compile or runtime code generation targeting Android's Dalvik VM
Apache License 2.0
1.88k stars 249 forks source link

[Android] error with org.mockito:mockito-core:3.2.4 #157

Closed dss99911 closed 4 years ago

dss99911 commented 4 years ago

tested on com.linkedin.dexmaker:dexmaker-mockito:2.12.1

when I try to mock in AndroidTest the below error occurs.

and It's working fine on on "org.mockito:mockito-core:2.8.9"

and checked the reason and I found that com.android.dx.mockito.InvocationHandlerAdapter.ProxyInvocation#ProxyInvocation didn't implement List<ArgumentMatcher> getArgumentsAsMatchers()

java.lang.AbstractMethodError: abstract method "java.util.List org.mockito.invocation.Invocation.getArgumentsAsMatchers()"
at org.mockito.internal.invocation.InvocationMatcher.<init>(InvocationMatcher.java:38)
at org.mockito.internal.invocation.MatchersBinder.bindMatchers(MatchersBinder.java:30)
at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:59)
at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29)
at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:35)
at com.android.dx.mockito.InvocationHandlerAdapter.invoke(InvocationHandlerAdapter.java:58)
at androidx.navigation.NavController_Proxy.navigate(Unknown Source:17)
at kim.jeonghyeon.androidlibrary.architecture.mvvm.BaseFragment.navigate(BaseFragment.kt:244)
at com.example.android.architecture.blueprints.todoapp.tasks.TasksFragment.openTaskDetails(TasksFragment.kt:100)
at com.example.android.architecture.blueprints.todoapp.tasks.TasksFragment.access$openTaskDetails(TasksFragment.kt:33)
at com.example.android.architecture.blueprints.todoapp.tasks.TasksFragment$onViewModelSetup$$inlined$with$lambda$1.invoke(TasksFragment.kt:70)
at com.example.android.architecture.blueprints.todoapp.tasks.TasksFragment$onViewModelSetup$$inlined$with$lambda$1.invoke(TasksFragment.kt:33)
at kim.jeonghyeon.androidlibrary.architecture.livedata.LiveObjectKt$observeEvent$1.onChanged(LiveObject.kt:128)
at kim.jeonghyeon.androidlibrary.architecture.livedata.LiveObject$observeEvent$1.onChanged(LiveObject.kt:109)
at androidx.lifecycle.LiveData.considerNotify(LiveData.java:131)
at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:149)
at androidx.lifecycle.LiveData.setValue(LiveData.java:307)
at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50)
at kim.jeonghyeon.androidlibrary.architecture.livedata.LiveObject.setValue(LiveObject.kt:117)
at androidx.lifecycle.LiveData$1.run(LiveData.java:91)
at androidx.arch.core.executor.testing.InstantTaskExecutorRule$1.postToMainThread(InstantTaskExecutorRule.java:43)
at androidx.arch.core.executor.ArchTaskExecutor.postToMainThread(ArchTaskExecutor.java:101)
at androidx.lifecycle.LiveData.postValue(LiveData.java:291)
at androidx.lifecycle.MutableLiveData.postValue(MutableLiveData.java:45)
at kim.jeonghyeon.androidlibrary.architecture.livedata.LiveObjectKt.call(LiveObject.kt:212)
at com.example.android.architecture.blueprints.todoapp.tasks.TasksViewModel.openTask$sample_testing_codelab_freeMockDebug(TasksViewModel.kt:118)
at com.example.android.architecture.blueprints.todoapp.tasks.TaskItemViewModel.onTaskClicked(TaskItemViewModel.kt:20)
at com.example.android.architecture.blueprints.todoapp.databinding.TaskItemBindingImpl._internalCallbackOnClick(TaskItemBindingImpl.java:207)
at com.example.android.architecture.blueprints.todoapp.generated.callback.OnClickListener.onClick(OnClickListener.java:11)
at android.view.View.performClick(View.java:7125)
at android.view.View.performClickInternal(View.java:7102)
at android.view.View.access$3500(View.java:801)
at android.view.View$PerformClick.run(View.java:27336)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at androidx.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:148)
at androidx.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:525)
at androidx.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:484)
at androidx.test.espresso.base.UiControllerImpl.injectMotionEvent(UiControllerImpl.java:236)
at androidx.test.espresso.action.MotionEvents.sendUp(MotionEvents.java:162)
at androidx.test.espresso.action.MotionEvents.sendUp(MotionEvents.java:139)
at androidx.test.espresso.action.Tap.sendSingleTap(Tap.java:170)
at androidx.test.espresso.action.Tap.access$100(Tap.java:31)
at androidx.test.espresso.action.Tap$1.sendTap(Tap.java:47)
at androidx.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:137)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:366)
at androidx.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:255)
at androidx.test.espresso.ViewInteraction.access$100(ViewInteraction.java:65)
at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:158)
at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:155)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
dss99911 commented 4 years ago

it's working fine on "com.linkedin.dexmaker:dexmaker-mockito:2.25.1" android studio didn't suggest new version of 2.25.1. so I didn't know latest version exists