From 4ba03bdf29455148b5d2c0323a40ffb65f362e43 Mon Sep 17 00:00:00 2001
From: Phillipus
Date: Mon, 25 Nov 2024 12:01:40 +0000
Subject: [PATCH] Add support for Mockito/ByteBuddy requiring javaagent on Java
21
- See https://github.com/mockito/mockito/issues/3037
- See https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#0.3
- Requires Mockito 5.14.0 or later which allows you to specify Mockito itself as an agent rather than ByteBuddy
- Note - all test plug-ins need to declare a dependency on Mockito so that the mockito jar property ${org.mockito:mockito-core:jar} is always resolved for each test run
- To run JUnit in Eclipse you need to add the following VM arguments (adjust path version as required):
-Xshare:off
-javaagent:${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.mockito.mockito-core_5.14.2.jar
- Or, for now, it's simpler to add the following VM arguments:
-Xshare:off
-XX:+EnableDynamicAgentLoading
---
.github/workflows/tests.yml | 2 +-
com.archimatetool.editor.product/archi.target | 4 +--
tests/pom.xml | 32 ++++++++++++++++---
3 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 39d4741fe..e7e6eb1e1 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -14,7 +14,7 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v4
with:
- java-version: '17'
+ java-version: '21'
distribution: 'temurin'
cache: 'maven'
diff --git a/com.archimatetool.editor.product/archi.target b/com.archimatetool.editor.product/archi.target
index e301a7b4b..02b8ff379 100644
--- a/com.archimatetool.editor.product/archi.target
+++ b/com.archimatetool.editor.product/archi.target
@@ -10,8 +10,8 @@
-
-
+
+
\ No newline at end of file
diff --git a/tests/pom.xml b/tests/pom.xml
index bbe611cb3..14b618af3 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -12,13 +12,21 @@
com.archimatetool.testing
pom
-
+
+
+
+ -Xshare:off -javaagent:${org.mockito:mockito-core:jar}
+
+
+ ${mockito.args}
+
+
Orbit
p2
- https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.32.0
+ https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.34.0
@@ -26,8 +34,8 @@
com.archimatetool.testsupport
com.archimatetool.canvas.tests
- com.archimatetool.csv.tests
com.archimatetool.commandline.tests
+ com.archimatetool.csv.tests
com.archimatetool.editor.tests
com.archimatetool.export.svg.tests
com.archimatetool.hammer.tests
@@ -43,6 +51,20 @@
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.8.1
+
+
+
+ properties
+
+
+
+
+
org.eclipse.tycho
tycho-surefire-plugin
@@ -59,14 +81,14 @@
- osx
+ mac
mac
- -XstartOnFirstThread
+ -XstartOnFirstThread ${mockito.args}