How to enable final class mocking with mockito in eclipse project?












0















I am using mockito-core-2.7.21 in a maven project and it is working as expected.



But to enable mocking of final class I created a file mockito-extensionsorg.mockito.plugins.MockMaker under my source folder and added the text mock-maker-inline.



As per https://www.baeldung.com/mockito-final and also Mock final class with Mockito 2, it should allow me to mock final classes but when i running my junit test I am getting the below error:



Java Version: 1.8



OS: Windows 10



Junit: 4 and 5(I tried both)



java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker
at org.mockito.internal.configuration.plugins.PluginLoader$1.invoke(PluginLoader.java:66)
at com.sun.proxy.$Proxy7.isTypeMockable(Unknown Source)
at org.mockito.internal.util.MockUtil.typeMockabilityOf(MockUtil.java:29)
at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)
at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:186)
at org.mockito.internal.creation.MockSettingsImpl.confirm(MockSettingsImpl.java:180)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:62)
at org.mockito.Mockito.mock(Mockito.java:1729)
at org.mockito.Mockito.mock(Mockito.java:1642)
at siemens.esd.grpc.services.UTCreateModuleServiceTest.testCreateBlockInterface(UTCreateModuleServiceTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@6f75e721
at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:101)
at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:45)
at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:18)
at org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:17)
at org.mockito.internal.configuration.GlobalConfiguration.tryGetPluginAnnotationEngine(GlobalConfiguration.java:55)
at org.mockito.MockitoAnnotations.initMocks(MockitoAnnotations.java:68)
at siemens.esd.grpc.services.UTCreateModuleServiceTest.setUp(UTCreateModuleServiceTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
... 15 more
Caused by: org.mockito.exceptions.base.MockitoInitializationException:
Could not initialize inline Byte Buddy mock maker. (This mock maker is not supported on Android.)

Java : 1.8
JVM vendor name : Oracle Corporation
JVM vendor version : 25.181-b13
JVM name : Java HotSpot(TM) 64-Bit Server VM
JVM version : 1.8.0_181-b13
JVM info : mixed mode
OS name : Windows 10
OS version : 10.0

at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<init>(InlineByteBuddyMockMaker.java:172)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:96)
... 29 more
Caused by: java.lang.IllegalStateException: No compatible attachment provider is not available
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:347)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:332)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:300)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:286)
at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<clinit>(InlineByteBuddyMockMaker.java:102)
... 35 more









share|improve this question



























    0















    I am using mockito-core-2.7.21 in a maven project and it is working as expected.



    But to enable mocking of final class I created a file mockito-extensionsorg.mockito.plugins.MockMaker under my source folder and added the text mock-maker-inline.



    As per https://www.baeldung.com/mockito-final and also Mock final class with Mockito 2, it should allow me to mock final classes but when i running my junit test I am getting the below error:



    Java Version: 1.8



    OS: Windows 10



    Junit: 4 and 5(I tried both)



    java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker
    at org.mockito.internal.configuration.plugins.PluginLoader$1.invoke(PluginLoader.java:66)
    at com.sun.proxy.$Proxy7.isTypeMockable(Unknown Source)
    at org.mockito.internal.util.MockUtil.typeMockabilityOf(MockUtil.java:29)
    at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)
    at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:186)
    at org.mockito.internal.creation.MockSettingsImpl.confirm(MockSettingsImpl.java:180)
    at org.mockito.internal.MockitoCore.mock(MockitoCore.java:62)
    at org.mockito.Mockito.mock(Mockito.java:1729)
    at org.mockito.Mockito.mock(Mockito.java:1642)
    at siemens.esd.grpc.services.UTCreateModuleServiceTest.testCreateBlockInterface(UTCreateModuleServiceTest.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
    Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@6f75e721
    at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:101)
    at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:45)
    at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:18)
    at org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:17)
    at org.mockito.internal.configuration.GlobalConfiguration.tryGetPluginAnnotationEngine(GlobalConfiguration.java:55)
    at org.mockito.MockitoAnnotations.initMocks(MockitoAnnotations.java:68)
    at siemens.esd.grpc.services.UTCreateModuleServiceTest.setUp(UTCreateModuleServiceTest.java:22)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    ... 15 more
    Caused by: org.mockito.exceptions.base.MockitoInitializationException:
    Could not initialize inline Byte Buddy mock maker. (This mock maker is not supported on Android.)

    Java : 1.8
    JVM vendor name : Oracle Corporation
    JVM vendor version : 25.181-b13
    JVM name : Java HotSpot(TM) 64-Bit Server VM
    JVM version : 1.8.0_181-b13
    JVM info : mixed mode
    OS name : Windows 10
    OS version : 10.0

    at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<init>(InlineByteBuddyMockMaker.java:172)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:96)
    ... 29 more
    Caused by: java.lang.IllegalStateException: No compatible attachment provider is not available
    at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:347)
    at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:332)
    at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:300)
    at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:286)
    at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<clinit>(InlineByteBuddyMockMaker.java:102)
    ... 35 more









    share|improve this question

























      0












      0








      0








      I am using mockito-core-2.7.21 in a maven project and it is working as expected.



      But to enable mocking of final class I created a file mockito-extensionsorg.mockito.plugins.MockMaker under my source folder and added the text mock-maker-inline.



      As per https://www.baeldung.com/mockito-final and also Mock final class with Mockito 2, it should allow me to mock final classes but when i running my junit test I am getting the below error:



      Java Version: 1.8



      OS: Windows 10



      Junit: 4 and 5(I tried both)



      java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker
      at org.mockito.internal.configuration.plugins.PluginLoader$1.invoke(PluginLoader.java:66)
      at com.sun.proxy.$Proxy7.isTypeMockable(Unknown Source)
      at org.mockito.internal.util.MockUtil.typeMockabilityOf(MockUtil.java:29)
      at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)
      at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:186)
      at org.mockito.internal.creation.MockSettingsImpl.confirm(MockSettingsImpl.java:180)
      at org.mockito.internal.MockitoCore.mock(MockitoCore.java:62)
      at org.mockito.Mockito.mock(Mockito.java:1729)
      at org.mockito.Mockito.mock(Mockito.java:1642)
      at siemens.esd.grpc.services.UTCreateModuleServiceTest.testCreateBlockInterface(UTCreateModuleServiceTest.java:29)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
      Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@6f75e721
      at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:101)
      at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:45)
      at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:18)
      at org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:17)
      at org.mockito.internal.configuration.GlobalConfiguration.tryGetPluginAnnotationEngine(GlobalConfiguration.java:55)
      at org.mockito.MockitoAnnotations.initMocks(MockitoAnnotations.java:68)
      at siemens.esd.grpc.services.UTCreateModuleServiceTest.setUp(UTCreateModuleServiceTest.java:22)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      ... 15 more
      Caused by: org.mockito.exceptions.base.MockitoInitializationException:
      Could not initialize inline Byte Buddy mock maker. (This mock maker is not supported on Android.)

      Java : 1.8
      JVM vendor name : Oracle Corporation
      JVM vendor version : 25.181-b13
      JVM name : Java HotSpot(TM) 64-Bit Server VM
      JVM version : 1.8.0_181-b13
      JVM info : mixed mode
      OS name : Windows 10
      OS version : 10.0

      at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<init>(InlineByteBuddyMockMaker.java:172)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at java.lang.Class.newInstance(Unknown Source)
      at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:96)
      ... 29 more
      Caused by: java.lang.IllegalStateException: No compatible attachment provider is not available
      at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:347)
      at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:332)
      at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:300)
      at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:286)
      at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<clinit>(InlineByteBuddyMockMaker.java:102)
      ... 35 more









      share|improve this question














      I am using mockito-core-2.7.21 in a maven project and it is working as expected.



      But to enable mocking of final class I created a file mockito-extensionsorg.mockito.plugins.MockMaker under my source folder and added the text mock-maker-inline.



      As per https://www.baeldung.com/mockito-final and also Mock final class with Mockito 2, it should allow me to mock final classes but when i running my junit test I am getting the below error:



      Java Version: 1.8



      OS: Windows 10



      Junit: 4 and 5(I tried both)



      java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker
      at org.mockito.internal.configuration.plugins.PluginLoader$1.invoke(PluginLoader.java:66)
      at com.sun.proxy.$Proxy7.isTypeMockable(Unknown Source)
      at org.mockito.internal.util.MockUtil.typeMockabilityOf(MockUtil.java:29)
      at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)
      at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:186)
      at org.mockito.internal.creation.MockSettingsImpl.confirm(MockSettingsImpl.java:180)
      at org.mockito.internal.MockitoCore.mock(MockitoCore.java:62)
      at org.mockito.Mockito.mock(Mockito.java:1729)
      at org.mockito.Mockito.mock(Mockito.java:1642)
      at siemens.esd.grpc.services.UTCreateModuleServiceTest.testCreateBlockInterface(UTCreateModuleServiceTest.java:29)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
      Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in sun.misc.CompoundEnumeration@6f75e721
      at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:101)
      at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:45)
      at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:18)
      at org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:17)
      at org.mockito.internal.configuration.GlobalConfiguration.tryGetPluginAnnotationEngine(GlobalConfiguration.java:55)
      at org.mockito.MockitoAnnotations.initMocks(MockitoAnnotations.java:68)
      at siemens.esd.grpc.services.UTCreateModuleServiceTest.setUp(UTCreateModuleServiceTest.java:22)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      ... 15 more
      Caused by: org.mockito.exceptions.base.MockitoInitializationException:
      Could not initialize inline Byte Buddy mock maker. (This mock maker is not supported on Android.)

      Java : 1.8
      JVM vendor name : Oracle Corporation
      JVM vendor version : 25.181-b13
      JVM name : Java HotSpot(TM) 64-Bit Server VM
      JVM version : 1.8.0_181-b13
      JVM info : mixed mode
      OS name : Windows 10
      OS version : 10.0

      at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<init>(InlineByteBuddyMockMaker.java:172)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at java.lang.Class.newInstance(Unknown Source)
      at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:96)
      ... 29 more
      Caused by: java.lang.IllegalStateException: No compatible attachment provider is not available
      at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:347)
      at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:332)
      at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:300)
      at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:286)
      at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.<clinit>(InlineByteBuddyMockMaker.java:102)
      ... 35 more






      mockito






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '18 at 11:22









      Sanjit Kumar MishraSanjit Kumar Mishra

      663525




      663525
























          1 Answer
          1






          active

          oldest

          votes


















          0














          After struggling I found the problem is with the java library available in your java build path.
          If you have JRE library in you java build path instead of JDK library then bytebuddy utility is throwing this issue.



          Hence the solution to the problem is use JDK library instead of JRE library.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445774%2fhow-to-enable-final-class-mocking-with-mockito-in-eclipse-project%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            After struggling I found the problem is with the java library available in your java build path.
            If you have JRE library in you java build path instead of JDK library then bytebuddy utility is throwing this issue.



            Hence the solution to the problem is use JDK library instead of JRE library.






            share|improve this answer




























              0














              After struggling I found the problem is with the java library available in your java build path.
              If you have JRE library in you java build path instead of JDK library then bytebuddy utility is throwing this issue.



              Hence the solution to the problem is use JDK library instead of JRE library.






              share|improve this answer


























                0












                0








                0







                After struggling I found the problem is with the java library available in your java build path.
                If you have JRE library in you java build path instead of JDK library then bytebuddy utility is throwing this issue.



                Hence the solution to the problem is use JDK library instead of JRE library.






                share|improve this answer













                After struggling I found the problem is with the java library available in your java build path.
                If you have JRE library in you java build path instead of JDK library then bytebuddy utility is throwing this issue.



                Hence the solution to the problem is use JDK library instead of JRE library.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 27 '18 at 7:32









                Sanjit Kumar MishraSanjit Kumar Mishra

                663525




                663525
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445774%2fhow-to-enable-final-class-mocking-with-mockito-in-eclipse-project%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Wiesbaden

                    Marschland

                    Dieringhausen