You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2024/05/05 16:22:53 UTC

(maven-compiler-plugin) branch master updated: [MCOMPILER-588] JUnit4 test framework to JUnit5 migration

This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 15905f3  [MCOMPILER-588] JUnit4 test framework to JUnit5 migration
15905f3 is described below

commit 15905f339904087df15ba3f812c2fc153f2b0a75
Author: Mikhail Deviatov <mi...@gmail.com>
AuthorDate: Thu Apr 18 19:52:45 2024 +0200

    [MCOMPILER-588] JUnit4 test framework to JUnit5 migration
---
 pom.xml                                            |   6 +-
 .../maven/plugin/compiler/CompilerMojoTest.java    | 301 ++++++++++++++
 .../plugin/compiler/CompilerMojoTestCase.java      | 440 ---------------------
 .../maven/plugin/compiler/MojoTestUtils.java       |  75 ++++
 .../plugin/compiler/TestCompilerMojoTest.java      | 189 +++++++++
 .../src/test/java/TestCompile0Test.java            |   4 +-
 .../src/test/java/TestCompile0Test.java            |   4 +-
 .../src/test/java/TestCompile0Test.java            |   4 +-
 .../src/test/java/TestCompile0Test.java            |   4 +-
 .../src/test/java/TestCompile1TestCase.java        |   4 +-
 .../src/test/java/TestCompile2TestCase.java        |   4 +-
 .../src/test/java/TestCompile3TestCase.java        |   4 +-
 .../src/test/java/TestCompile4TestCase.java        |   4 +-
 .../src/test/java/TestCompile2TestCase.java        |   4 +-
 .../src/test/java/TestCompile3TestCase.java        |   4 +-
 .../src/test/java/TestCompile4TestCase.java        |   4 +-
 .../src/test/java/TestCompile2TestCase.java        |   4 +-
 .../src/test/java/TestCompile3TestCase.java        |   4 +-
 .../src/test/java/TestCompile4TestCase.java        |   4 +-
 .../src/test/java/TestSkipMainCompile0Test.java    |   4 +-
 .../src/test/java/TestSkipTestCompile0Test.java    |   4 +-
 21 files changed, 584 insertions(+), 491 deletions(-)

diff --git a/pom.xml b/pom.xml
index a11a74a..79fe3c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -181,9 +181,9 @@ under the License.
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.13.2</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.9.1</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTest.java b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTest.java
new file mode 100644
index 0000000..8d852ba
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTest.java
@@ -0,0 +1,301 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugin.compiler;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.compiler.stubs.CompilerManagerStub;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugin.testing.junit5.InjectMojo;
+import org.apache.maven.plugin.testing.junit5.MojoTest;
+import org.apache.maven.plugin.testing.stubs.ArtifactStub;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMavenProject;
+import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMavenSession;
+import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMojoExecution;
+import static org.apache.maven.plugin.compiler.MojoTestUtils.getVariableValueFromObject;
+import static org.apache.maven.plugin.compiler.MojoTestUtils.setVariableValueToObject;
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.ArgumentMatchers.startsWith;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
+@MojoTest
+class CompilerMojoTest {
+
+    private static final String COMPILE = "compile";
+
+    /**
+     * tests the ability of the plugin to compile a basic file
+     *
+     * @throws Exception
+     */
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-basic-test/plugin-config.xml")
+    void testCompilerBasic(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        Log log = mock(Log.class);
+
+        compilerMojo.setLog(log);
+
+        setVariableValueToObject(compilerMojo, "targetOrReleaseSet", false);
+        compilerMojo.execute();
+
+        Artifact projectArtifact = getVariableValueFromObject(compilerMojo, "projectArtifact");
+        assertNotNull(
+                projectArtifact.getFile(),
+                "MCOMPILER-94: artifact file should only be null if there is nothing to compile");
+
+        File testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestCompile0.class");
+
+        verify(log).warn(startsWith("No explicit value set for target or release!"));
+
+        assertTrue(testClass::exists);
+    }
+
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-basic-sourcetarget/plugin-config.xml")
+    void testCompilerBasicSourceTarget(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        Log log = mock(Log.class);
+
+        compilerMojo.setLog(log);
+
+        compilerMojo.execute();
+
+        verify(log, never()).warn(startsWith("No explicit value set for target or release!"));
+    }
+
+    /**
+     * tests the ability of the plugin to respond to empty source
+     *
+     * @throws Exception
+     */
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-empty-source-test/plugin-config.xml")
+    void testCompilerEmptySource(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        compilerMojo.execute();
+
+        assertFalse(compilerMojo.getOutputDirectory().exists());
+
+        Artifact projectArtifact = getVariableValueFromObject(compilerMojo, "projectArtifact");
+        assertNull(
+                projectArtifact.getFile(), "MCOMPILER-94: artifact file should be null if there is nothing to compile");
+    }
+
+    /**
+     * tests the ability of the plugin to respond to includes and excludes correctly
+     *
+     * @throws Exception
+     */
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-includes-excludes-test/plugin-config.xml")
+    void testCompilerIncludesExcludes(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        Set<String> includes = new HashSet<>();
+        includes.add("**/TestCompile4*.java");
+        setVariableValueToObject(compilerMojo, "includes", includes);
+
+        Set<String> excludes = new HashSet<>();
+        excludes.add("**/TestCompile2*.java");
+        excludes.add("**/TestCompile3*.java");
+        setVariableValueToObject(compilerMojo, "excludes", excludes);
+
+        compilerMojo.execute();
+
+        File testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestCompile2.class");
+        assertFalse(testClass.exists());
+
+        testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestCompile3.class");
+        assertFalse(testClass.exists());
+
+        testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestCompile4.class");
+        assertTrue(testClass.exists());
+    }
+
+    /**
+     * tests the ability of the plugin to fork and successfully compile
+     *
+     * @throws Exception
+     */
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-fork-test/plugin-config.xml")
+    void testCompilerFork(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+        // JAVA_HOME doesn't have to be on the PATH.
+        setVariableValueToObject(
+                compilerMojo, "executable", new File(System.getenv("JAVA_HOME"), "bin/javac").getPath());
+
+        compilerMojo.execute();
+
+        File testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestCompile1.class");
+        assertTrue(testClass.exists());
+    }
+
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-one-output-file-test/plugin-config.xml")
+    void testOneOutputFileForAllInput(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        setVariableValueToObject(compilerMojo, "compilerManager", new CompilerManagerStub());
+
+        compilerMojo.execute();
+
+        File testClass = new File(compilerMojo.getOutputDirectory(), "compiled.class");
+        assertTrue(testClass.exists());
+    }
+
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-args-test/plugin-config.xml")
+    void testCompilerArgs(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        setVariableValueToObject(compilerMojo, "compilerManager", new CompilerManagerStub());
+
+        compilerMojo.execute();
+
+        File testClass = new File(compilerMojo.getOutputDirectory(), "compiled.class");
+        assertTrue(testClass.exists());
+        assertEquals(
+                Arrays.asList("key1=value1", "-Xlint", "-my&special:param-with+chars/not>allowed_in_XML_element_names"),
+                compilerMojo.compilerArgs);
+    }
+
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-implicit-test/plugin-config-none.xml")
+    void testImplicitFlagNone(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        assertEquals("none", compilerMojo.getImplicit());
+    }
+
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-implicit-test/plugin-config-not-set.xml")
+    void testImplicitFlagNotSet(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        assertNull(compilerMojo.getImplicit());
+    }
+
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-one-output-file-test2/plugin-config.xml")
+    void testOneOutputFileForAllInput2(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        setVariableValueToObject(compilerMojo, "compilerManager", new CompilerManagerStub());
+
+        Set<String> includes = new HashSet<>();
+        includes.add("**/TestCompile4*.java");
+        setVariableValueToObject(compilerMojo, "includes", includes);
+
+        Set<String> excludes = new HashSet<>();
+        excludes.add("**/TestCompile2*.java");
+        excludes.add("**/TestCompile3*.java");
+        setVariableValueToObject(compilerMojo, "excludes", excludes);
+
+        compilerMojo.execute();
+
+        File testClass = new File(compilerMojo.getOutputDirectory(), "compiled.class");
+        assertTrue(testClass.exists());
+    }
+
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-fail-test/plugin-config.xml")
+    void testCompileFailure(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        setVariableValueToObject(compilerMojo, "compilerManager", new CompilerManagerStub(true));
+
+        try {
+            compilerMojo.execute();
+
+            fail("Should throw an exception");
+        } catch (CompilationFailureException e) {
+            // expected
+        }
+    }
+
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-failonerror-test/plugin-config.xml")
+    void testCompileFailOnError(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        setVariableValueToObject(compilerMojo, "compilerManager", new CompilerManagerStub(true));
+
+        try {
+            compilerMojo.execute();
+            assertTrue(true);
+        } catch (CompilationFailureException e) {
+            fail("The compilation error should have been consumed because failOnError = false");
+        }
+    }
+
+    /**
+     * Tests that setting 'skipMain' to true skips compilation of the main Java source files, but that test Java source
+     * files are still compiled.
+     * @throws Exception
+     */
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-skip-main/plugin-config.xml")
+    void testCompileSkipMain(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+        setVariableValueToObject(compilerMojo, "skipMain", true);
+        compilerMojo.execute();
+        File testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestSkipMainCompile0.class");
+        assertFalse(testClass.exists());
+    }
+
+    /**
+     * Tests that setting 'skip' to true skips compilation of the test Java source files, but that main Java source
+     * files are still compiled.
+     * @throws Exception
+     */
+    @Test
+    @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-skip-test/plugin-config.xml")
+    void testCompileSkipTest(CompilerMojo compilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(compilerMojo);
+
+        compilerMojo.execute();
+
+        File testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestSkipTestCompile0.class");
+        assertTrue(testClass.exists());
+    }
+
+    private void setUpCompilerMojoTestEnv(CompilerMojo mojo) throws Exception {
+        setVariableValueToObject(mojo, "projectArtifact", new ArtifactStub());
+        setVariableValueToObject(mojo, "compilePath", Collections.EMPTY_LIST);
+        setVariableValueToObject(mojo, "session", getMockMavenSession());
+        setVariableValueToObject(mojo, "project", getMockMavenProject());
+        setVariableValueToObject(mojo, "mojoExecution", getMockMojoExecution());
+        setVariableValueToObject(mojo, "source", AbstractCompilerMojo.DEFAULT_SOURCE);
+        setVariableValueToObject(mojo, "target", AbstractCompilerMojo.DEFAULT_TARGET);
+    }
+}
diff --git a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
deleted file mode 100644
index db72307..0000000
--- a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugin.compiler;
-
-import java.io.File;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.MojoExecution;
-import org.apache.maven.plugin.compiler.stubs.CompilerManagerStub;
-import org.apache.maven.plugin.compiler.stubs.DebugEnabledLog;
-import org.apache.maven.plugin.descriptor.MojoDescriptor;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.plugin.testing.stubs.ArtifactStub;
-import org.apache.maven.project.MavenProject;
-
-import static org.mockito.ArgumentMatchers.startsWith;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class CompilerMojoTestCase extends AbstractMojoTestCase {
-
-    /**
-     * tests the ability of the plugin to compile a basic file
-     *
-     * @throws Exception
-     */
-    public void testCompilerBasic() throws Exception {
-        CompilerMojo compileMojo = getCompilerMojo("target/test-classes/unit/compiler-basic-test/plugin-config.xml");
-
-        Log log = mock(Log.class);
-
-        compileMojo.setLog(log);
-
-        compileMojo.execute();
-
-        File testClass = new File(compileMojo.getOutputDirectory(), "foo/TestCompile0.class");
-
-        assertTrue(testClass.exists());
-
-        TestCompilerMojo testCompileMojo =
-                getTestCompilerMojo(compileMojo, "target/test-classes/unit/compiler-basic-test/plugin-config.xml");
-
-        testCompileMojo.execute();
-
-        Artifact projectArtifact = (Artifact) getVariableValueFromObject(compileMojo, "projectArtifact");
-        assertNotNull(
-                "MCOMPILER-94: artifact file should only be null if there is nothing to compile",
-                projectArtifact.getFile());
-
-        testClass = new File(testCompileMojo.getOutputDirectory(), "foo/TestCompile0Test.class");
-
-        verify(log).warn(startsWith("No explicit value set for target or release!"));
-
-        assertTrue(testClass.exists());
-    }
-
-    public void testCompilerBasicSourceTarget() throws Exception {
-        CompilerMojo compileMojo =
-                getCompilerMojo("target/test-classes/unit/compiler-basic-sourcetarget/plugin-config.xml");
-
-        Log log = mock(Log.class);
-
-        compileMojo.setLog(log);
-
-        compileMojo.execute();
-
-        verify(log, never()).warn(startsWith("No explicit value set for target or release!"));
-    }
-
-    /**
-     * tests the ability of the plugin to respond to empty source
-     *
-     * @throws Exception
-     */
-    public void testCompilerEmptySource() throws Exception {
-        CompilerMojo compileMojo =
-                getCompilerMojo("target/test-classes/unit/compiler-empty-source-test/plugin-config.xml");
-
-        compileMojo.execute();
-
-        assertFalse(compileMojo.getOutputDirectory().exists());
-
-        Artifact projectArtifact = (Artifact) getVariableValueFromObject(compileMojo, "projectArtifact");
-        assertNull(
-                "MCOMPILER-94: artifact file should be null if there is nothing to compile", projectArtifact.getFile());
-
-        TestCompilerMojo testCompileMojo = getTestCompilerMojo(
-                compileMojo, "target/test-classes/unit/compiler-empty-source-test/plugin-config.xml");
-
-        testCompileMojo.execute();
-
-        assertFalse(testCompileMojo.getOutputDirectory().exists());
-    }
-
-    /**
-     * tests the ability of the plugin to respond to includes and excludes correctly
-     *
-     * @throws Exception
-     */
-    public void testCompilerIncludesExcludes() throws Exception {
-        CompilerMojo compileMojo =
-                getCompilerMojo("target/test-classes/unit/compiler-includes-excludes-test/plugin-config.xml");
-
-        Set<String> includes = new HashSet<>();
-        includes.add("**/TestCompile4*.java");
-        setVariableValueToObject(compileMojo, "includes", includes);
-
-        Set<String> excludes = new HashSet<>();
-        excludes.add("**/TestCompile2*.java");
-        excludes.add("**/TestCompile3*.java");
-        setVariableValueToObject(compileMojo, "excludes", excludes);
-
-        compileMojo.execute();
-
-        File testClass = new File(compileMojo.getOutputDirectory(), "foo/TestCompile2.class");
-        assertFalse(testClass.exists());
-
-        testClass = new File(compileMojo.getOutputDirectory(), "foo/TestCompile3.class");
-        assertFalse(testClass.exists());
-
-        testClass = new File(compileMojo.getOutputDirectory(), "foo/TestCompile4.class");
-        assertTrue(testClass.exists());
-
-        TestCompilerMojo testCompileMojo = getTestCompilerMojo(
-                compileMojo, "target/test-classes/unit/compiler-includes-excludes-test/plugin-config.xml");
-
-        setVariableValueToObject(testCompileMojo, "testIncludes", includes);
-        setVariableValueToObject(testCompileMojo, "testExcludes", excludes);
-
-        testCompileMojo.execute();
-
-        testClass = new File(testCompileMojo.getOutputDirectory(), "foo/TestCompile2TestCase.class");
-        assertFalse(testClass.exists());
-
-        testClass = new File(testCompileMojo.getOutputDirectory(), "foo/TestCompile3TestCase.class");
-        assertFalse(testClass.exists());
-
-        testClass = new File(testCompileMojo.getOutputDirectory(), "foo/TestCompile4TestCase.class");
-        assertTrue(testClass.exists());
-    }
-
-    /**
-     * tests the ability of the plugin to fork and successfully compile
-     *
-     * @throws Exception
-     */
-    public void testCompilerFork() throws Exception {
-        CompilerMojo compileMojo = getCompilerMojo("target/test-classes/unit/compiler-fork-test/plugin-config.xml");
-
-        // JAVA_HOME doesn't have to be on the PATH.
-        setVariableValueToObject(
-                compileMojo, "executable", new File(System.getenv("JAVA_HOME"), "bin/javac").getPath());
-
-        compileMojo.execute();
-
-        File testClass = new File(compileMojo.getOutputDirectory(), "foo/TestCompile1.class");
-        assertTrue(testClass.exists());
-
-        TestCompilerMojo testCompileMojo =
-                getTestCompilerMojo(compileMojo, "target/test-classes/unit/compiler-fork-test/plugin-config.xml");
-
-        // JAVA_HOME doesn't have to be on the PATH.
-        setVariableValueToObject(
-                testCompileMojo, "executable", new File(System.getenv("JAVA_HOME"), "bin/javac").getPath());
-
-        testCompileMojo.execute();
-
-        testClass = new File(testCompileMojo.getOutputDirectory(), "foo/TestCompile1TestCase.class");
-        assertTrue(testClass.exists());
-    }
-
-    public void testOneOutputFileForAllInput() throws Exception {
-        CompilerMojo compileMojo =
-                getCompilerMojo("target/test-classes/unit/compiler-one-output-file-test/plugin-config.xml");
-
-        setVariableValueToObject(compileMojo, "compilerManager", new CompilerManagerStub());
-
-        compileMojo.execute();
-
-        File testClass = new File(compileMojo.getOutputDirectory(), "compiled.class");
-        assertTrue(testClass.exists());
-
-        TestCompilerMojo testCompileMojo = getTestCompilerMojo(
-                compileMojo, "target/test-classes/unit/compiler-one-output-file-test/plugin-config.xml");
-
-        setVariableValueToObject(testCompileMojo, "compilerManager", new CompilerManagerStub());
-
-        testCompileMojo.execute();
-
-        testClass = new File(testCompileMojo.getOutputDirectory(), "compiled.class");
-        assertTrue(testClass.exists());
-    }
-
-    public void testCompilerArgs() throws Exception {
-        CompilerMojo compileMojo = getCompilerMojo("target/test-classes/unit/compiler-args-test/plugin-config.xml");
-
-        setVariableValueToObject(compileMojo, "compilerManager", new CompilerManagerStub());
-
-        compileMojo.execute();
-
-        File testClass = new File(compileMojo.getOutputDirectory(), "compiled.class");
-        assertTrue(testClass.exists());
-        assertEquals(
-                Arrays.asList("key1=value1", "-Xlint", "-my&special:param-with+chars/not>allowed_in_XML_element_names"),
-                compileMojo.compilerArgs);
-    }
-
-    public void testImplicitFlagNone() throws Exception {
-        CompilerMojo compileMojo =
-                getCompilerMojo("target/test-classes/unit/compiler-implicit-test/plugin-config-none.xml");
-
-        assertEquals("none", compileMojo.getImplicit());
-    }
-
-    public void testImplicitFlagNotSet() throws Exception {
-        CompilerMojo compileMojo =
-                getCompilerMojo("target/test-classes/unit/compiler-implicit-test/plugin-config-not-set.xml");
-
-        assertNull(compileMojo.getImplicit());
-    }
-
-    public void testOneOutputFileForAllInput2() throws Exception {
-        CompilerMojo compileMojo =
-                getCompilerMojo("target/test-classes/unit/compiler-one-output-file-test2/plugin-config.xml");
-
-        setVariableValueToObject(compileMojo, "compilerManager", new CompilerManagerStub());
-
-        Set<String> includes = new HashSet<>();
-        includes.add("**/TestCompile4*.java");
-        setVariableValueToObject(compileMojo, "includes", includes);
-
-        Set<String> excludes = new HashSet<>();
-        excludes.add("**/TestCompile2*.java");
-        excludes.add("**/TestCompile3*.java");
-        setVariableValueToObject(compileMojo, "excludes", excludes);
-
-        compileMojo.execute();
-
-        File testClass = new File(compileMojo.getOutputDirectory(), "compiled.class");
-        assertTrue(testClass.exists());
-
-        TestCompilerMojo testCompileMojo = getTestCompilerMojo(
-                compileMojo, "target/test-classes/unit/compiler-one-output-file-test2/plugin-config.xml");
-
-        setVariableValueToObject(testCompileMojo, "compilerManager", new CompilerManagerStub());
-        setVariableValueToObject(testCompileMojo, "testIncludes", includes);
-        setVariableValueToObject(testCompileMojo, "testExcludes", excludes);
-
-        testCompileMojo.execute();
-
-        testClass = new File(testCompileMojo.getOutputDirectory(), "compiled.class");
-        assertTrue(testClass.exists());
-    }
-
-    public void testCompileFailure() throws Exception {
-        CompilerMojo compileMojo = getCompilerMojo("target/test-classes/unit/compiler-fail-test/plugin-config.xml");
-
-        setVariableValueToObject(compileMojo, "compilerManager", new CompilerManagerStub(true));
-
-        try {
-            compileMojo.execute();
-
-            fail("Should throw an exception");
-        } catch (CompilationFailureException e) {
-            // expected
-        }
-    }
-
-    public void testCompileFailOnError() throws Exception {
-        CompilerMojo compileMojo =
-                getCompilerMojo("target/test-classes/unit/compiler-failonerror-test/plugin-config.xml");
-
-        setVariableValueToObject(compileMojo, "compilerManager", new CompilerManagerStub(true));
-
-        try {
-            compileMojo.execute();
-            assertTrue(true);
-        } catch (CompilationFailureException e) {
-            fail("The compilation error should have been consumed because failOnError = false");
-        }
-    }
-
-    /**
-     * Tests that setting 'skipMain' to true skips compilation of the main Java source files, but that test Java source
-     * files are still compiled.
-     * @throws Exception
-     */
-    public void testCompileSkipMain() throws Exception {
-        CompilerMojo compileMojo = getCompilerMojo("target/test-classes/unit/compiler-skip-main/plugin-config.xml");
-        setVariableValueToObject(compileMojo, "skipMain", true);
-        compileMojo.execute();
-        File testClass = new File(compileMojo.getOutputDirectory(), "foo/TestSkipMainCompile0.class");
-        assertFalse(testClass.exists());
-
-        TestCompilerMojo testCompileMojo =
-                getTestCompilerMojo(compileMojo, "target/test-classes/unit/compiler-skip-main/plugin-config.xml");
-        testCompileMojo.execute();
-        testClass = new File(testCompileMojo.getOutputDirectory(), "foo/TestSkipMainCompile0Test.class");
-        assertTrue(testClass.exists());
-    }
-
-    /**
-     * Tests that setting 'skip' to true skips compilation of the test Java source files, but that main Java source
-     * files are still compiled.
-     * @throws Exception
-     */
-    public void testCompileSkipTest() throws Exception {
-        CompilerMojo compileMojo = getCompilerMojo("target/test-classes/unit/compiler-skip-test/plugin-config.xml");
-        compileMojo.execute();
-        File testClass = new File(compileMojo.getOutputDirectory(), "foo/TestSkipTestCompile0.class");
-        assertTrue(testClass.exists());
-
-        TestCompilerMojo testCompileMojo =
-                getTestCompilerMojo(compileMojo, "target/test-classes/unit/compiler-skip-test/plugin-config.xml");
-        setVariableValueToObject(testCompileMojo, "skip", true);
-        testCompileMojo.execute();
-        testClass = new File(testCompileMojo.getOutputDirectory(), "foo/TestSkipTestCompile0Test.class");
-        assertFalse(testClass.exists());
-    }
-
-    private CompilerMojo getCompilerMojo(String pomXml) throws Exception {
-        File testPom = new File(getBasedir(), pomXml);
-
-        CompilerMojo mojo = (CompilerMojo) lookupMojo("compile", testPom);
-
-        setVariableValueToObject(mojo, "log", new DebugEnabledLog());
-        setVariableValueToObject(mojo, "projectArtifact", new ArtifactStub());
-        setVariableValueToObject(mojo, "compilePath", Collections.EMPTY_LIST);
-        setVariableValueToObject(mojo, "session", getMockMavenSession());
-        setVariableValueToObject(mojo, "project", getMockMavenProject());
-        setVariableValueToObject(mojo, "mojoExecution", getMockMojoExecution());
-        setVariableValueToObject(mojo, "source", AbstractCompilerMojo.DEFAULT_SOURCE);
-        setVariableValueToObject(mojo, "target", AbstractCompilerMojo.DEFAULT_TARGET);
-
-        return mojo;
-    }
-
-    private TestCompilerMojo getTestCompilerMojo(CompilerMojo compilerMojo, String pomXml) throws Exception {
-        File testPom = new File(getBasedir(), pomXml);
-
-        TestCompilerMojo mojo = (TestCompilerMojo) lookupMojo("testCompile", testPom);
-
-        setVariableValueToObject(mojo, "log", new DebugEnabledLog());
-
-        File buildDir = (File) getVariableValueFromObject(compilerMojo, "buildDirectory");
-        File testClassesDir = new File(buildDir, "test-classes");
-        setVariableValueToObject(mojo, "outputDirectory", testClassesDir);
-
-        List<String> testClasspathList = new ArrayList<>();
-
-        Artifact junitArtifact = mock(Artifact.class);
-        ArtifactHandler handler = mock(ArtifactHandler.class);
-        when(handler.isAddedToClasspath()).thenReturn(true);
-        when(junitArtifact.getArtifactHandler()).thenReturn(handler);
-
-        String junitURI = org.junit.Test.class.getResource("Test.class").toURI().toString();
-        junitURI = junitURI.substring("jar:".length(), junitURI.indexOf('!'));
-        File artifactFile = new File(URI.create(junitURI));
-        when(junitArtifact.getFile()).thenReturn(artifactFile);
-
-        testClasspathList.add(artifactFile.getAbsolutePath());
-        testClasspathList.add(compilerMojo.getOutputDirectory().getPath());
-
-        String testSourceRoot = testPom.getParent() + "/src/test/java";
-        setVariableValueToObject(mojo, "compileSourceRoots", Collections.singletonList(testSourceRoot));
-
-        MavenProject project = getMockMavenProject();
-        project.setFile(testPom);
-        project.addCompileSourceRoot("/src/main/java");
-        project.setArtifacts(Collections.singleton(junitArtifact));
-        project.getBuild().setOutputDirectory(new File(buildDir, "classes").getAbsolutePath());
-        setVariableValueToObject(mojo, "project", project);
-        setVariableValueToObject(mojo, "testPath", testClasspathList);
-        setVariableValueToObject(mojo, "session", getMockMavenSession());
-        setVariableValueToObject(mojo, "mojoExecution", getMockMojoExecution());
-        setVariableValueToObject(mojo, "source", AbstractCompilerMojo.DEFAULT_SOURCE);
-        setVariableValueToObject(mojo, "target", AbstractCompilerMojo.DEFAULT_TARGET);
-
-        return mojo;
-    }
-
-    private MavenProject getMockMavenProject() {
-        MavenProject mp = new MavenProject();
-        mp.getBuild().setDirectory("target");
-        mp.getBuild().setOutputDirectory("target/classes");
-        mp.getBuild().setSourceDirectory("src/main/java");
-        mp.getBuild().setTestOutputDirectory("target/test-classes");
-        return mp;
-    }
-
-    private MavenSession getMockMavenSession() {
-        MavenSession session = mock(MavenSession.class);
-        // when( session.getPluginContext( isA(PluginDescriptor.class), isA(MavenProject.class) ) ).thenReturn(
-        // Collections.emptyMap() );
-        when(session.getCurrentProject()).thenReturn(getMockMavenProject());
-        return session;
-    }
-
-    private MojoExecution getMockMojoExecution() {
-        MojoDescriptor md = new MojoDescriptor();
-        md.setGoal("compile");
-
-        MojoExecution me = new MojoExecution(md);
-
-        PluginDescriptor pd = new PluginDescriptor();
-        pd.setArtifactId("maven-compiler-plugin");
-        md.setPluginDescriptor(pd);
-
-        return me;
-    }
-}
diff --git a/src/test/java/org/apache/maven/plugin/compiler/MojoTestUtils.java b/src/test/java/org/apache/maven/plugin/compiler/MojoTestUtils.java
new file mode 100644
index 0000000..7173d64
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugin/compiler/MojoTestUtils.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugin.compiler;
+
+import java.lang.reflect.Field;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.ReflectionUtils;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class MojoTestUtils {
+
+    public static <T> T getVariableValueFromObject(Object object, String variable) throws IllegalAccessException {
+        Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses(variable, object.getClass());
+        field.setAccessible(true);
+        return (T) field.get(object);
+    }
+
+    public static <T> void setVariableValueToObject(Object object, String variable, T value)
+            throws IllegalAccessException {
+        Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses(variable, object.getClass());
+        field.setAccessible(true);
+        field.set(object, value);
+    }
+
+    public static MavenProject getMockMavenProject() {
+        MavenProject mp = new MavenProject();
+        mp.getBuild().setDirectory("target");
+        mp.getBuild().setOutputDirectory("target/classes");
+        mp.getBuild().setSourceDirectory("src/main/java");
+        mp.getBuild().setTestOutputDirectory("target/test-classes");
+        return mp;
+    }
+
+    public static MavenSession getMockMavenSession() {
+        MavenSession session = mock(MavenSession.class);
+        // when( session.getPluginContext( isA(PluginDescriptor.class), isA(MavenProject.class) ) ).thenReturn(
+        // Collections.emptyMap() );
+        when(session.getCurrentProject()).thenReturn(getMockMavenProject());
+        return session;
+    }
+
+    public static MojoExecution getMockMojoExecution() {
+        MojoDescriptor md = new MojoDescriptor();
+        MojoExecution me = new MojoExecution(md);
+
+        PluginDescriptor pd = new PluginDescriptor();
+        pd.setArtifactId("maven-compiler-plugin");
+        md.setPluginDescriptor(pd);
+
+        return me;
+    }
+}
diff --git a/src/test/java/org/apache/maven/plugin/compiler/TestCompilerMojoTest.java b/src/test/java/org/apache/maven/plugin/compiler/TestCompilerMojoTest.java
new file mode 100644
index 0000000..19a18ef
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugin/compiler/TestCompilerMojoTest.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugin.compiler;
+
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.plugin.compiler.stubs.CompilerManagerStub;
+import org.apache.maven.plugin.testing.junit5.InjectMojo;
+import org.apache.maven.plugin.testing.junit5.MojoTest;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMavenProject;
+import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMavenSession;
+import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMojoExecution;
+import static org.apache.maven.plugin.compiler.MojoTestUtils.getVariableValueFromObject;
+import static org.apache.maven.plugin.compiler.MojoTestUtils.setVariableValueToObject;
+import static org.junit.jupiter.api.Assertions.*;
+
+@MojoTest
+class TestCompilerMojoTest {
+
+    private static final String TEST_COMPILE = "testCompile";
+
+    @Test
+    @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-basic-test/plugin-config.xml")
+    void testCompilerBasic(TestCompilerMojo testCompilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(testCompilerMojo);
+
+        testCompilerMojo.execute();
+
+        File testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestCompile0Test.class");
+
+        assertTrue(testClass::exists);
+    }
+
+    @Test
+    @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-empty-source-test/plugin-config.xml")
+    public void testCompilerEmptySource(TestCompilerMojo testCompilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(testCompilerMojo);
+
+        testCompilerMojo.execute();
+
+        assertFalse(testCompilerMojo.getOutputDirectory().exists());
+    }
+
+    @Test
+    @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-includes-excludes-test/plugin-config.xml")
+    void testCompilerIncludesExcludes(TestCompilerMojo testCompilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(testCompilerMojo);
+
+        Set<String> includes = new HashSet<>();
+        includes.add("**/TestCompile4*.java");
+        setVariableValueToObject(testCompilerMojo, "testIncludes", includes);
+
+        Set<String> excludes = new HashSet<>();
+        excludes.add("**/TestCompile2*.java");
+        excludes.add("**/TestCompile3*.java");
+        setVariableValueToObject(testCompilerMojo, "testExcludes", excludes);
+
+        testCompilerMojo.execute();
+
+        File testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestCompile2TestCase.class");
+        assertFalse(testClass.exists());
+
+        testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestCompile3TestCase.class");
+        assertFalse(testClass.exists());
+
+        testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestCompile4TestCase.class");
+        assertTrue(testClass.exists());
+    }
+
+    @Test
+    @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-fork-test/plugin-config.xml")
+    void testCompilerFork(TestCompilerMojo testCompilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(testCompilerMojo);
+
+        // JAVA_HOME doesn't have to be on the PATH.
+        setVariableValueToObject(
+                testCompilerMojo, "executable", new File(System.getenv("JAVA_HOME"), "bin/javac").getPath());
+
+        testCompilerMojo.execute();
+
+        File testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestCompile1TestCase.class");
+        assertTrue(testClass.exists());
+    }
+
+    @Test
+    @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-one-output-file-test/plugin-config.xml")
+    void testOneOutputFileForAllInput(TestCompilerMojo testCompilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(testCompilerMojo);
+
+        setVariableValueToObject(testCompilerMojo, "compilerManager", new CompilerManagerStub());
+
+        testCompilerMojo.execute();
+
+        File testClass = new File(testCompilerMojo.getOutputDirectory(), "compiled.class");
+        assertTrue(testClass.exists());
+    }
+
+    @Test
+    @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-one-output-file-test2/plugin-config.xml")
+    void testOneOutputFileForAllInput2(TestCompilerMojo testCompilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(testCompilerMojo);
+
+        setVariableValueToObject(testCompilerMojo, "compilerManager", new CompilerManagerStub());
+
+        Set<String> includes = new HashSet<>();
+        includes.add("**/TestCompile4*.java");
+        setVariableValueToObject(testCompilerMojo, "testIncludes", includes);
+
+        Set<String> excludes = new HashSet<>();
+        excludes.add("**/TestCompile2*.java");
+        excludes.add("**/TestCompile3*.java");
+        setVariableValueToObject(testCompilerMojo, "testExcludes", excludes);
+
+        testCompilerMojo.execute();
+
+        File testClass = new File(testCompilerMojo.getOutputDirectory(), "compiled.class");
+        assertTrue(testClass.exists());
+    }
+
+    @Test
+    @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-skip-main/plugin-config.xml")
+    void testCompileSkipMain(TestCompilerMojo testCompilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(testCompilerMojo);
+
+        testCompilerMojo.execute();
+
+        File testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestSkipMainCompile0Test.class");
+        assertTrue(testClass.exists());
+    }
+
+    @Test
+    @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-skip-test/plugin-config.xml")
+    void testCompileSkipTest(TestCompilerMojo testCompilerMojo) throws Exception {
+        setUpCompilerMojoTestEnv(testCompilerMojo);
+
+        setVariableValueToObject(testCompilerMojo, "skip", true);
+
+        testCompilerMojo.execute();
+
+        File testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestSkipTestCompile0Test.class");
+        assertFalse(testClass.exists());
+    }
+
+    private void setUpCompilerMojoTestEnv(TestCompilerMojo mojo) throws Exception {
+        File buildDir = getVariableValueFromObject(mojo, "buildDirectory");
+        File testClassesDir = new File(buildDir, "test-classes");
+        setVariableValueToObject(mojo, "outputDirectory", testClassesDir);
+
+        setVariableValueToObject(mojo, "project", getMockMavenProject());
+
+        Path baseDir = mojo.getOutputDirectory()
+                .toPath()
+                .resolveSibling(Paths.get("..", "..", "..", "..", "test-classes"))
+                .normalize();
+        Path subpath = mojo.getOutputDirectory().toPath().subpath(baseDir.getNameCount(), baseDir.getNameCount() + 2);
+        String sourceRoot = baseDir.resolve(subpath) + "/src/main/java";
+        String testSourceRoot = baseDir.resolve(subpath) + "/src/test/java";
+
+        setVariableValueToObject(mojo, "compileSourceRoots", Arrays.asList(sourceRoot, testSourceRoot));
+
+        setVariableValueToObject(mojo, "session", getMockMavenSession());
+        setVariableValueToObject(mojo, "mojoExecution", getMockMojoExecution());
+        setVariableValueToObject(mojo, "source", AbstractCompilerMojo.DEFAULT_SOURCE);
+        setVariableValueToObject(mojo, "target", AbstractCompilerMojo.DEFAULT_TARGET);
+    }
+}
diff --git a/src/test/resources/unit/compiler-args-test/src/test/java/TestCompile0Test.java b/src/test/resources/unit/compiler-args-test/src/test/java/TestCompile0Test.java
index 837ab64..264b6ab 100644
--- a/src/test/resources/unit/compiler-args-test/src/test/java/TestCompile0Test.java
+++ b/src/test/resources/unit/compiler-args-test/src/test/java/TestCompile0Test.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile0Test extends TestCase {
+public class TestCompile0Test {
     public void testCompile0Test() {
         TestCompile0 test = new TestCompile0();
     }
diff --git a/src/test/resources/unit/compiler-basic-test/src/test/java/TestCompile0Test.java b/src/test/resources/unit/compiler-basic-test/src/test/java/TestCompile0Test.java
index 837ab64..264b6ab 100644
--- a/src/test/resources/unit/compiler-basic-test/src/test/java/TestCompile0Test.java
+++ b/src/test/resources/unit/compiler-basic-test/src/test/java/TestCompile0Test.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile0Test extends TestCase {
+public class TestCompile0Test {
     public void testCompile0Test() {
         TestCompile0 test = new TestCompile0();
     }
diff --git a/src/test/resources/unit/compiler-fail-test/src/test/java/TestCompile0Test.java b/src/test/resources/unit/compiler-fail-test/src/test/java/TestCompile0Test.java
index 837ab64..264b6ab 100644
--- a/src/test/resources/unit/compiler-fail-test/src/test/java/TestCompile0Test.java
+++ b/src/test/resources/unit/compiler-fail-test/src/test/java/TestCompile0Test.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile0Test extends TestCase {
+public class TestCompile0Test {
     public void testCompile0Test() {
         TestCompile0 test = new TestCompile0();
     }
diff --git a/src/test/resources/unit/compiler-failonerror-test/src/test/java/TestCompile0Test.java b/src/test/resources/unit/compiler-failonerror-test/src/test/java/TestCompile0Test.java
index 837ab64..264b6ab 100644
--- a/src/test/resources/unit/compiler-failonerror-test/src/test/java/TestCompile0Test.java
+++ b/src/test/resources/unit/compiler-failonerror-test/src/test/java/TestCompile0Test.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile0Test extends TestCase {
+public class TestCompile0Test {
     public void testCompile0Test() {
         TestCompile0 test = new TestCompile0();
     }
diff --git a/src/test/resources/unit/compiler-fork-test/src/test/java/TestCompile1TestCase.java b/src/test/resources/unit/compiler-fork-test/src/test/java/TestCompile1TestCase.java
index 14288af..2121488 100644
--- a/src/test/resources/unit/compiler-fork-test/src/test/java/TestCompile1TestCase.java
+++ b/src/test/resources/unit/compiler-fork-test/src/test/java/TestCompile1TestCase.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile1TestCase extends TestCase {
+public class TestCompile1TestCase {
     public void testCompile1() {
         TestCompile1 test = new TestCompile1();
     }
diff --git a/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile2TestCase.java b/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile2TestCase.java
index ea864c3..7d6cf4d 100644
--- a/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile2TestCase.java
+++ b/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile2TestCase.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile2TestCase extends TestCase {
+public class TestCompile2TestCase {
     public void testCompile2() {
         TestCompile2 test = new TestCompile2();
     }
diff --git a/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile3TestCase.java b/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile3TestCase.java
index 4f1fe01..1d48506 100644
--- a/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile3TestCase.java
+++ b/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile3TestCase.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile3TestCase extends TestCase {
+public class TestCompile3TestCase {
     public void testCompile3() {
         TestCompile3 test = new TestCompile3();
     }
diff --git a/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile4TestCase.java b/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile4TestCase.java
index c357cb8..7d39b07 100644
--- a/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile4TestCase.java
+++ b/src/test/resources/unit/compiler-includes-excludes-test/src/test/java/TestCompile4TestCase.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile4TestCase extends TestCase {
+public class TestCompile4TestCase {
     public void testCompile4() {
         TestCompile4 test = new TestCompile4();
     }
diff --git a/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile2TestCase.java b/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile2TestCase.java
index ea864c3..7d6cf4d 100644
--- a/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile2TestCase.java
+++ b/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile2TestCase.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile2TestCase extends TestCase {
+public class TestCompile2TestCase {
     public void testCompile2() {
         TestCompile2 test = new TestCompile2();
     }
diff --git a/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile3TestCase.java b/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile3TestCase.java
index 4f1fe01..1d48506 100644
--- a/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile3TestCase.java
+++ b/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile3TestCase.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile3TestCase extends TestCase {
+public class TestCompile3TestCase {
     public void testCompile3() {
         TestCompile3 test = new TestCompile3();
     }
diff --git a/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile4TestCase.java b/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile4TestCase.java
index c357cb8..7d39b07 100644
--- a/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile4TestCase.java
+++ b/src/test/resources/unit/compiler-one-output-file-test/src/test/java/TestCompile4TestCase.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile4TestCase extends TestCase {
+public class TestCompile4TestCase {
     public void testCompile4() {
         TestCompile4 test = new TestCompile4();
     }
diff --git a/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile2TestCase.java b/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile2TestCase.java
index ea864c3..7d6cf4d 100644
--- a/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile2TestCase.java
+++ b/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile2TestCase.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile2TestCase extends TestCase {
+public class TestCompile2TestCase {
     public void testCompile2() {
         TestCompile2 test = new TestCompile2();
     }
diff --git a/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile3TestCase.java b/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile3TestCase.java
index 4f1fe01..1d48506 100644
--- a/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile3TestCase.java
+++ b/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile3TestCase.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile3TestCase extends TestCase {
+public class TestCompile3TestCase {
     public void testCompile3() {
         TestCompile3 test = new TestCompile3();
     }
diff --git a/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile4TestCase.java b/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile4TestCase.java
index c357cb8..7d39b07 100644
--- a/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile4TestCase.java
+++ b/src/test/resources/unit/compiler-one-output-file-test2/src/test/java/TestCompile4TestCase.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestCompile4TestCase extends TestCase {
+public class TestCompile4TestCase {
     public void testCompile4() {
         TestCompile4 test = new TestCompile4();
     }
diff --git a/src/test/resources/unit/compiler-skip-main/src/test/java/TestSkipMainCompile0Test.java b/src/test/resources/unit/compiler-skip-main/src/test/java/TestSkipMainCompile0Test.java
index e6c7d96..ae9fd98 100644
--- a/src/test/resources/unit/compiler-skip-main/src/test/java/TestSkipMainCompile0Test.java
+++ b/src/test/resources/unit/compiler-skip-main/src/test/java/TestSkipMainCompile0Test.java
@@ -18,8 +18,6 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestSkipMainCompile0Test extends TestCase {
+public class TestSkipMainCompile0Test {
     public void testSkipMainCompile0Test() {}
 }
diff --git a/src/test/resources/unit/compiler-skip-test/src/test/java/TestSkipTestCompile0Test.java b/src/test/resources/unit/compiler-skip-test/src/test/java/TestSkipTestCompile0Test.java
index d316c10..2eda7b3 100644
--- a/src/test/resources/unit/compiler-skip-test/src/test/java/TestSkipTestCompile0Test.java
+++ b/src/test/resources/unit/compiler-skip-test/src/test/java/TestSkipTestCompile0Test.java
@@ -18,9 +18,7 @@
  */
 package foo;
 
-import junit.framework.TestCase;
-
-public class TestSkipTestCompile0Test extends TestCase {
+public class TestSkipTestCompile0Test {
     public void testSkipTestCompile0Test() {
         TestSkipTestCompile0 test = new TestSkipTestCompile0();
     }