Thursday, August 23, 2018

Re: Problem with using gwtmockito and

Hi Lars,

I really appreciate your support, thanks.

Yes we had a small patch In GwtMockitotestRunner, but I tested with the unpatched version also (different test now):

[ERROR] testGetMissingActivity(de.***.***.client.app.init.***ActivityMapperTest)  Time elapsed: 0 s  <<< ERROR!
java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)
        at org.mockito.internal.configuration.plugins.PluginLoader$1.invoke(PluginLoader.java:74)
        at com.sun.proxy.$Proxy28.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:238)
        at org.mockito.internal.creation.MockSettingsImpl.build(MockSettingsImpl.java:226)
        at org.mockito.internal.MockitoCore.mock(MockitoCore.java:68)
        at org.mockito.Mockito.mock(Mockito.java:1895)
        at org.mockito.Mockito.mock(Mockito.java:1867)
        at de.***.***.test.TestingMessagesFactory.setupMessagesForReturnMethodNameAsStringForAnyCalledMethod(TestingMessagesFactory.java:30)
        at de.***.***.test.TestingMessagesFactory.createMessages(TestingMessagesFactory.java:23)
        at de.***.***.test.TestingMessagesFactory.<init>(TestingMessagesFactory.java:15)
        at de.***.***.test.abstracttest.ClientContext.<init>(ClientContext.java:114)
        at de.***.***.test.abstracttest.ClientContext.$ClientContext(ClientContext.java:110)
        at de.***.***.client.app.init.***ActivityMapperTest.<init>(***ActivityMapperTest.java:33)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
        at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
        at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
        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 com.google.gwtmockito.GwtMockitoTestRunner.run(GwtMockitoTestRunner.java:373)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:379)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:340)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:413)
Caused by: java.lang.IllegalAccessError: failed to access class net.bytebuddy.implementation.Implementation$Target$AbstractBase$DefaultMethodInvocation from class net.byteb
uddy.dynamic.scaffold.subclass.SubclassImplementationTarget$Factory
        at net.bytebuddy.dynamic.scaffold.subclass.SubclassImplementationTarget$Factory.make(SubclassImplementationTarget.java:149)
        at net.bytebuddy.dynamic.scaffold.MethodRegistry$Default$Prepared.compile(MethodRegistry.java:668)
        at net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:171)
        at net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:163)
        at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:2669)
        at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$Delegator.make(DynamicType.java:2771)
        at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$UsingUnsafeInjection.make(ClassInjector.java:761)
        at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$CreationAction.run(ClassInjector.java:375)
        at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$CreationAction.run(ClassInjector.java:362)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection.<clinit>(ClassInjector.java:68)
        at org.mockito.internal.creation.bytebuddy.SubclassInjectionLoader.<init>(SubclassInjectionLoader.java:28)
        at org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker.<init>(SubclassByteBuddyMockMaker.java:33)
        at org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.<init>(ByteBuddyMockMaker.java:21)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
        at java.base/java.lang.Class.newInstance(Class.java:560)
        at org.mockito.internal.configuration.plugins.DefaultMockitoPlugins.create(DefaultMockitoPlugins.java:66)
        at org.mockito.internal.configuration.plugins.DefaultMockitoPlugins.getDefaultPlugin(DefaultMockitoPlugins.java:43)
        at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:67)
        at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:44)
        at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:21)
        at org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:18)
        at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:24)
        at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)
        at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:238)
        at org.mockito.internal.creation.MockSettingsImpl.build(MockSettingsImpl.java:226)
        at org.mockito.internal.MockitoCore.mock(MockitoCore.java:68)
        at org.mockito.Mockito.mock(Mockito.java:1895)
        at org.mockito.Mockito.mock(Mockito.java:1867)
        at de.***.***.test.abstracttest.ClientBundleFactory.setup***CssForReturnMethodNameAsStringForAnyCalledMethod(ClientBundleFactory.java:68)
        at de.***.***.test.abstracttest.ClientBundleFactory.<init>(ClientBundleFactory.java:40)
        at de.***.***.test.abstracttest.ClientContext.<init>(ClientContext.java:82)
        ... 27 more

We have no unwanted dependency that I can find

$ mvn dependency:tree | grep mockito
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- com.google.gwt.gwtmockito:gwtmockito:jar:1.1.8:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- com.google.gwt.gwtmockito:gwtmockito:jar:1.1.8:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] +- com.google.gwt.gwtmockito:gwtmockito:jar:1.1.8:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test

$ mvn dependency:tree | grep bytebuddy
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] +- net.bytebuddy:byte-buddy-agent:jar:1.8.17:compile

As you see I updated bytebuddy to 1.8.17




On Tuesday, August 21, 2018 at 4:33:12 PM UTC+2, alexand...@pixel.de wrote:
Hello All,

sorry if this is not a pure GWT question. I was wondering if any of you is successfully using gwtmockito with Java 9 or later (I tried with Java 10). Apparently by updating mockito and gwtmockito to recent versions it should work. I am using
gwtmockito 1.1.8
and mockito2.21.0

and I still am getting a 

> java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker


> Caused by: java.lang.IllegalAccessError: failed to access class net.bytebuddy.implementation.Implementation$Target$AbstractBase$DefaultMethodInvocation from class net.bytebuddy.dynamic.scaffold.subclass.SubclassImplementationTarget$Factory

we are using Java 10. I documented the error on https://github.com/google/gwtmockito/issues/75 and would try to tackle it myself but have no idea where to start

Any help will be greatly appreciated. Thank you,

Alex

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment