-
Notifications
You must be signed in to change notification settings - Fork 206
Closed
Description
Mockito have recently refactored the MockUtils class to be a static utility class (with a private constructor):
mockito/mockito@3fe3b62#diff-321079f7242b016035f4577222dfe7a3R26
However, mockito-kotlin tries to instantiate an instance of it - see CreateInstance.kt line 180:
return MockUtil().createMock(creationSettings).apply...
This causes the following runtime error when executing a test which calls the any() method:
java.lang.IllegalAccessError: tried to access method org.mockito.internal.util.MockUtil.<init>()V from class com.nhaarman.mockito_kotlin.CreateInstanceKt
at com.nhaarman.mockito_kotlin.CreateInstanceKt.uncheckedMock(CreateInstance.kt:180)
at com.nhaarman.mockito_kotlin.CreateInstanceKt.createInstance(CreateInstance.kt:58)
The fix should just be to call the static method instead - MockUtil.createMock(creationSettings).apply...
Metadata
Metadata
Assignees
Labels
No labels