Index: .classpath
===================================================================
--- .classpath	(revision 16587)
+++ .classpath	(working copy)
@@ -22,12 +22,12 @@
 			<attribute name="test" value="true"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4">
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
 		<attributes>
 			<attribute name="test" value="true"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=JOSM&amp;ivyXmlPath=ivy.xml&amp;confs=*&amp;ivySettingsPath=ivysettings.xml&amp;loadSettingsOnDemand=false&amp;ivyUserDir=&amp;propertyFiles="/>
+	<classpathentry exported="true" kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=JOSM&amp;ivyXmlPath=ivy.xml&amp;confs=*&amp;ivySettingsPath=ivysettings.xml&amp;loadSettingsOnDemand=false&amp;ivyUserDir=&amp;propertyFiles="/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
 		<attributes>
 			<attribute name="module" value="true"/>
Index: build.xml
===================================================================
--- build.xml	(revision 16587)
+++ build.xml	(working copy)
@@ -447,51 +447,52 @@
         <attribute name="excludes" default="${default-junit@{testITsuffix}-excludes}"/>
         <sequential>
             <echo message="Running @{testfamily}@{testITsuffix} tests with JUnit"/>
-            <jacoco:coverage destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}"
-                inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
-                <junit printsummary="${junit.printsummary}" fork="true" forkmode="once" failureproperty="test.@{testfamily}@{testITsuffix}.failed">
-                    <jvmarg value="-Dfile.encoding=UTF-8"/>
-                    <jvmarg value="-javaagent:${test.dir}/lib/jmockit.jar"/>
-                    <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
-                    <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
-                    <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
-                    <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
-                    <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
-                    <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
-                    <jvmarg value="--add-opens" if:set="isJava9" />
-                    <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
-                    <jvmarg value="--add-opens" if:set="isJava9" />
-                    <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
-                    <jvmarg value="--add-opens" if:set="isJava9" />
-                    <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
-                    <jvmarg value="--add-opens" if:set="isJava9" />
-                    <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
-                    <jvmarg value="--add-opens" if:set="isJava9" />
-                    <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
-                    <jvmarg value="--add-opens" if:set="isJava9" />
-                    <jvmarg value="java.base/jdk.internal.loader=ALL-UNNAMED" if:set="isJava9" />
-                    <jvmarg value="--add-opens" if:set="isJava9" />
-                    <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
-                    <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
-                    <sysproperty key="josm.test.data" value="${test.dir}/data"/>
-                    <sysproperty key="java.awt.headless" value="${test.headless}"/>
-                    <sysproperty key="glass.platform" value="Monocle"/>
-                    <sysproperty key="monocle.platform" value="Headless"/>
-                    <sysproperty key="prism.order" value="sw"/>
-                    <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
-                    <classpath>
-                        <path refid="test.classpath"/>
-                        <pathelement path="${test.dir}/build/unit"/>
-                        <pathelement path="${test.dir}/build/@{testfamily}"/>
-                        <pathelement path="${test.dir}/config"/>
-                    </classpath>
-                    <formatter type="plain"/>
-                    <formatter type="xml"/>
-                    <batchtest fork="yes" todir="${test.dir}/report">
-                        <fileset dir="${test.dir}/build/@{testfamily}" includes="@{includes}" excludes="@{excludes}"/>
-                    </batchtest>
-                </junit>
-            </jacoco:coverage>
+            <jacoco:agent destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}" dumponexit="true"
+		    inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}" property="jacocoagent@{testfamily}@{testITsuffix}" if:true="@{coverage}"/>
+            <junitlauncher printsummary="${junit.printsummary}" failureproperty="test.@{testfamily}@{testITsuffix}.failed">
+                <classpath>
+                    <path refid="test.classpath"/>
+                    <pathelement path="${test.dir}/build/unit"/> <!-- required for functional/etc to have JOSMTestRules -->
+                    <pathelement path="${test.dir}/build/@{testfamily}"/>
+                </classpath>
+                <testclasses outputDir="${test.dir}/report">
+                    <fileset dir="${test.dir}/build/@{testfamily}" includes="@{includes}" excludes="@{excludes}"/>
+	                <fork>
+	                    <jvmarg value="${jacocoagent@{testfamily}@{testITsuffix}}" if:set="jacocoagent@{testfamily}@{testITsuffix}" />
+	                    <jvmarg value="-Dfile.encoding=UTF-8"/>
+	                    <jvmarg value="-javaagent:${test.dir}/lib/jmockit.jar"/>
+	                    <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
+	                    <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
+	                    <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
+	                    <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
+	                    <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
+	                    <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
+	                    <jvmarg value="--add-opens" if:set="isJava9" />
+	                    <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
+	                    <jvmarg value="--add-opens" if:set="isJava9" />
+	                    <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
+	                    <jvmarg value="--add-opens" if:set="isJava9" />
+	                    <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
+	                    <jvmarg value="--add-opens" if:set="isJava9" />
+	                    <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
+	                    <jvmarg value="--add-opens" if:set="isJava9" />
+	                    <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
+	                    <jvmarg value="--add-opens" if:set="isJava9" />
+	                    <jvmarg value="java.base/jdk.internal.loader=ALL-UNNAMED" if:set="isJava9" />
+	                    <jvmarg value="--add-opens" if:set="isJava9" />
+	                    <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
+	                    <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
+	                    <sysproperty key="josm.test.data" value="${test.dir}/data"/>
+	                    <sysproperty key="java.awt.headless" value="${test.headless}"/>
+	                    <sysproperty key="glass.platform" value="Monocle"/>
+	                    <sysproperty key="monocle.platform" value="Headless"/>
+	                    <sysproperty key="prism.order" value="sw"/>
+	                    <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
+	                </fork>
+                    <listener type="legacy-plain" />
+                    <listener type="legacy-xml" />
+                </testclasses>
+            </junitlauncher>
         </sequential>
     </macrodef>
     <target name="test" depends="test-compile" unless="test.notRequired"
@@ -603,11 +604,11 @@
 
         # Keep serialization code
         -keepclassmembers class * implements java.io.Serializable {
-            static final long serialVersionUID; 
+            static final long serialVersionUID;
             private static final java.io.ObjectStreamField[] serialPersistentFields;
             private void writeObject(java.io.ObjectOutputStream);
             private void readObject(java.io.ObjectInputStream);
-            java.lang.Object writeReplace(); 
+            java.lang.Object writeReplace();
             java.lang.Object readResolve();
         }
 
Index: ivy.xml
===================================================================
--- ivy.xml	(revision 16587)
+++ ivy.xml	(working copy)
@@ -58,7 +58,11 @@
         </dependency>
         <dependency conf="test->default" org="com.github.tomakehurst" name="wiremock" rev="2.26.3"/>
         <dependency conf="test->default" org="io.github.classgraph" name="classgraph" rev="4.8.67"/>
-        <dependency conf="test->default" org="junit" name="junit" rev="4.12"/>
+        <dependency conf="test->default" org="org.junit.platform" name="junit-platform-launcher" rev="1.6.2"/>
+        <dependency conf="test->default" org="org.junit.vintage" name="junit-vintage-engine" rev="5.6.2"/>
+        <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-api" rev="5.6.2"/>
+        <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-engine" rev="5.6.2"/>
+        <dependency conf="test->default" org="org.junit.jupiter" name="junit-jupiter-migrationsupport" rev="5.6.2"/>
         <dependency conf="test->default" org="net.trajano.commons" name="commons-testing" rev="2.1.0"/>
         <dependency conf="test->default" org="nl.jqno.equalsverifier" name="equalsverifier" rev="3.1.13"/>
         <dependency conf="test->default" org="org.apache.commons" name="commons-lang3" rev="3.10"/>
Index: test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
===================================================================
--- test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java	(revision 16587)
+++ test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java	(working copy)
@@ -23,6 +23,9 @@
 import java.util.logging.Handler;
 
 import org.awaitility.Awaitility;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.rules.TemporaryFolder;
 import org.junit.rules.TestRule;
 import org.junit.runner.Description;
@@ -78,7 +81,7 @@
  *
  * @author Michael Zangl
  */
-public class JOSMTestRules implements TestRule {
+public class JOSMTestRules implements TestRule, AfterEachCallback, BeforeEachCallback {
     private int timeout = isDebugMode() ? -1 : 10 * 1000;
     private TemporaryFolder josmHome;
     private boolean usePreferences = false;
@@ -432,6 +435,28 @@
         return statement;
     }
 
+    @Override
+    public void beforeEach(ExtensionContext context) throws Exception {
+        Statement temporaryStatement = new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                // do nothing
+            }
+        };
+        try {
+            this.apply(temporaryStatement,
+                    Description.createTestDescription(this.getClass(), "JOSMTestRules JUnit5 Compatibility"))
+                    .evaluate();
+        } catch (Throwable e) {
+            throw new Exception(e);
+        }
+    }
+
+    @Override
+    public void afterEach(ExtensionContext context) throws Exception {
+        // do nothing for now
+    }
+
     /**
      * Set up before running a test
      * @throws InitializationError If an error occurred while creating the required environment.
@@ -548,7 +573,7 @@
         }
 
         if (territories) {
-            Territories.initializeInternalData();
+            Territories.initialize();
         }
 
         if (this.edtAssertionMockingRunnable != null) {
