Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(tests): convert groovy based test to java while upgrading sp…
…ockframework to 2.2-groovy-3.0 (#1201) While upgrading spockframework from 2.0-groovy-3.0 to 2.2-groovy-3.0, encountered below errors during test execution of kork-exceptions and kork-pubsub-aws modules: ``` java.lang.ExceptionInInitializerError at org.spockframework.mock.runtime.CglibMockFactory.createMock(CglibMockFactory.java:24) at org.spockframework.mock.runtime.ProxyBasedMockFactory.create(ProxyBasedMockFactory.java:45) at org.spockframework.mock.runtime.JavaMockFactory.createInternal(JavaMockFactory.java:58) at org.spockframework.mock.runtime.JavaMockFactory.create(JavaMockFactory.java:38) at org.spockframework.mock.runtime.CompositeMockFactory.create(CompositeMockFactory.java:44) at org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:50) at org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:305) at org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:295) at org.spockframework.lang.SpecInternals.SpyImpl(SpecInternals.java:172) at com.netflix.spinnaker.kork.core.RetrySupportSpec.should retry until success or #maxRetries attempts is reached(RetrySupportSpec.groovy:28) Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4afcd809 at app//net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464) at app//net.sf.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:339) at app//net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:96) at app//net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:94) at app//net.sf.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:264) at app//net.sf.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) at app//net.sf.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) at app//net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:119) at app//net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:294) at app//net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221) at app//net.sf.cglib.core.KeyFactory.create(KeyFactory.java:174) at app//net.sf.cglib.core.KeyFactory.create(KeyFactory.java:153) at app//net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73) ... 10 more Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @4afcd809 at net.sf.cglib.core.ReflectUtils$1.run(ReflectUtils.java:61) at java.base/java.security.AccessController.doPrivileged(AccessController.java:569) at net.sf.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:52) at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:243) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) at net.sf.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:332) ... 22 more ``` In order to fix this issue, converted the groovy based test classes `RetrySupportSpec.groovy` and `SQSSubscriberSpec.groovy` as java test classes.
- Loading branch information