From 5721524870430a0a52849035a586f97772a0f77c Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Thu, 13 Jan 2022 11:03:47 -0500 Subject: [PATCH 1/3] fix: wire up jvm arg to avoid runtime error ```log Running TestSuite java.lang.RuntimeException: java.io.IOException: Can not attach to current VM at mockit.internal.startup.AgentLoader.attachToRunningVM(AgentLoader.java:150) at mockit.internal.startup.AgentLoader.loadAgent(AgentLoader.java:60) at mockit.internal.startup.Startup.initializeIfPossible(Startup.java:200) at mockit.integration.testng.TestNGRunnerDecorator.onExecutionStart(TestNGRunnerDecorator.java:348) at org.testng.TestNG.runExecutionListeners(TestNG.java:1055) at org.testng.TestNG.run(TestNG.java:1002) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:132) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:193) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:94) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:147) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121) Caused by: java.io.IOException: Can not attach to current VM at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.(HotSpotVirtualMachine.java:75) at jdk.attach/sun.tools.attach.VirtualMachineImpl.(VirtualMachineImpl.java:56) at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58) at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207) at mockit.internal.startup.AgentLoader.attachToRunningVM(AgentLoader.java:144) ... 12 more ``` --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 75db83a5372..9647113fae1 100644 --- a/pom.xml +++ b/pom.xml @@ -126,6 +126,7 @@ none:none -XX:+StartAttachListener + -Djdk.attach.allowAttachSelf=true From a0a52510d765755cec6494599f3aef505ad3401f Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Thu, 13 Jan 2022 11:07:49 -0500 Subject: [PATCH 2/3] fix: add dependency to avoid `NoClassDefFoundError` ```log java.lang.NoClassDefFoundError: javax/annotation/PostConstruct Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct ``` --- modules/swagger-codegen/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/swagger-codegen/pom.xml b/modules/swagger-codegen/pom.xml index 6d49a95e784..97f60053f36 100644 --- a/modules/swagger-codegen/pom.xml +++ b/modules/swagger-codegen/pom.xml @@ -198,6 +198,11 @@ 1.3.0 + + javax.annotation + javax.annotation-api + 1.3.2 + io.swagger swagger-parser From 2d146c9091abe7a833e4dbac6f4d056b4c0f28bd Mon Sep 17 00:00:00 2001 From: Peter Colapietro Date: Thu, 13 Jan 2022 11:08:58 -0500 Subject: [PATCH 3/3] fix: bump mockito dependency to avoid `UnsupportedOperationException` ``` Underlying exception : java.lang.UnsupportedOperationException: Cannot define class using reflection at io.swagger.codegen.languages.ScalaCodegenTest.shouldCallFormatIdentifierOnGetModelName(ScalaCodegenTest.java:27) Caused by: java.lang.UnsupportedOperationException: Cannot define class using reflection at io.swagger.codegen.languages.ScalaCodegenTest.shouldCallFormatIdentifierOnGetModelName(ScalaCodegenTest.java:27) Caused by: java.lang.IllegalArgumentException: Unknown Java version: 11 at io.swagger.codegen.languages.ScalaCodegenTest.shouldCallFormatIdentifierOnGetModelName(ScalaCodegenTest.java:27) shouldCallFormatIdentifierOnToEnumName(io.swagger.codegen.languages.ScalaCodegenTest) Time elapsed: 0.195 sec <<< FAILURE! org.mockito.exceptions.base.MockitoException: Mockito cannot mock this class: class io.swagger.codegen.languages.ScalaClientCodegen. Mockito can only mock non-private & non-final classes. If you're not sure why you're getting this error, please report to the mailing list. ``` see also: https://dev.to/scottshipp/how-to-fix-a-mockito-cannot-mock-this-class-exception-in-a-spring-boot-app-457e --- modules/swagger-codegen/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/swagger-codegen/pom.xml b/modules/swagger-codegen/pom.xml index 97f60053f36..109a668972d 100644 --- a/modules/swagger-codegen/pom.xml +++ b/modules/swagger-codegen/pom.xml @@ -299,7 +299,7 @@ org.mockito mockito-core - 2.8.47 + 2.28.2 test