Repository: jenkinsci/ansicolor-plugin
Pull request #319 (2025-02-10 13:42:54)

Migrate tests to JUnit5
This PR aims to migrate all tests to JUnit5. Changes include:

* Migrate annotations and imports
* Migrate assertions
* Remove public visibility for test classes and methods
* Minor clean up

I am well aware that this is a quite large changeset however I hope that there is still interest in this PR and it will be reviewed.
If there are any questions, please do not hesitate to ping me.

- [x] Make sure you are requesting to **pull a topic/feature/bugfix branch** (right side) and not your master branch!
- [x] Ensure that the pull request title represents the desired changelog entry
- [x] Please describe what you did
- [x] Link to relevant issues in GitHub 
- [x] Link to relevant pull requests, esp. upstream and downstream changes
- [x] Ensure you have provided tests - that demonstrates feature works or fixes the issue



Patch:
diff --git a/pom.xml b/pom.xml
index e197c7b..e5dc249 100644
--- a/pom.xml
+++ b/pom.xml
@@ -111,6 +111,11 @@
       <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-junit-jupiter</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <repositories>


Test patch:
diff --git a/src/test/java/hudson/plugins/ansicolor/AnsiColorBuildWrapperTest.java b/src/test/java/hudson/plugins/ansicolor/AnsiColorBuildWrapperTest.java
index 96f2f69..8206717 100644
--- a/src/test/java/hudson/plugins/ansicolor/AnsiColorBuildWrapperTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/AnsiColorBuildWrapperTest.java
@@ -2,41 +2,57 @@ package hudson.plugins.ansicolor;
 
 import hudson.Functions;
 import hudson.Launcher;
-import hudson.console.ConsoleNote;
-import hudson.model.*;
+import hudson.model.AbstractBuild;
+import hudson.model.BuildListener;
+import hudson.model.Descriptor;
+import hudson.model.FreeStyleBuild;
+import hudson.model.FreeStyleProject;
+import jakarta.servlet.ServletException;
 import joptsimple.internal.Strings;
 import net.sf.json.JSONObject;
 import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
 import org.jenkinsci.plugins.workflow.job.WorkflowJob;
-import org.junit.*;
-import org.junit.runner.RunWith;
-import org.jvnet.hudson.test.*;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.jvnet.hudson.test.Issue;
+import org.jvnet.hudson.test.JenkinsRule;
+import org.jvnet.hudson.test.TestBuilder;
+import org.jvnet.hudson.test.junit.jupiter.WithJenkins;
 import org.kohsuke.stapler.StaplerRequest2;
 import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
 
-import jakarta.servlet.ServletException;
 import java.io.IOException;
 import java.io.PrintStream;
 import java.io.StringWriter;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
 import java.util.function.Consumer;
-import java.util.logging.Level;
 import java.util.stream.Collectors;
 
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.not;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.when;
 
-public class AnsiColorBuildWrapperTest {
+@WithJenkins
+class AnsiColorBuildWrapperTest {
     private static final String ESC = "\033";
     private static final String CLR = ESC + "[2K";
 
-    @ClassRule
-    public static BuildWatcher buildWatcher = new BuildWatcher();
-
     @SuppressWarnings("unused")
     private enum CSI {
         CUU("A", 1),
@@ -67,256 +83,236 @@ public class AnsiColorBuildWrapperTest {
         }
     }
 
-    @Rule
-    public RestartableJenkinsRule jenkinsRule = new RestartableJenkinsRule();
-
-    @Rule
-    public LoggerRule logging = new LoggerRule().recordPackage(ConsoleNote.class, Level.FINE).record(ColorConsoleAnnotator.class, Level.FINER);
-
     @Test
-    public void testGetColorMapNameNull() {
+    void testGetColorMapNameNull(JenkinsRule jenkinsRule) {
         AnsiColorBuildWrapper instance = new AnsiColorBuildWrapper(null);
         assertEquals("xterm", instance.getColorMapName());
     }
 
     @Test
-    public void testGetColorMapNameVga() {
+    void testGetColorMapNameVga(JenkinsRule jenkinsRule) {
         AnsiColorBuildWrapper instance = new AnsiColorBuildWrapper("vga");
         assertEquals("vga", instance.getColorMapName());
     }
 
     @Test
-    public void testDecorateLogger() {
+    void testDecorateLogger(JenkinsRule jenkinsRule) {
         AnsiColorBuildWrapper ansiColorBuildWrapper = new AnsiColorBuildWrapper(null);
         assertThat(ansiColorBuildWrapper, instanceOf(AnsiColorBuildWrapper.class));
     }
 
     @Test
-    public void maven() {
-        jenkinsRule.then(r -> {
-            FreeStyleProject p = r.createFreeStyleProject();
-            p.getBuildWrappersList().add(new AnsiColorBuildWrapper(null));
-            p.getBuildersList().add(new TestBuilder() {
-                @Override
-                public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
-                    // Like Maven 3.6.0 when using (MNG-6380) MAVEN_OPTS=-Djansi.force=true
-                    listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] Scanning for projects...");
-                    listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] ");
-                    listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] \u001B[1m--------------< \u001B[0;36morg.jenkins-ci.plugins:build-token-root\u001B[0;1m >---------------\u001B[m");
-                    listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] \u001B[1mBuilding Build Authorization Token Root Plugin 1.5-SNAPSHOT\u001B[m");
-                    listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] \u001B[1m--------------------------------[ hpi ]---------------------------------\u001B[m");
-                    listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] ");
-                    listener.getLogger()
-                        .println(
-                            "[\u001B[1;34mINFO\u001B[m] \u001B[1m--- \u001B[0;32mmaven-clean-plugin:3.0.0:clean\u001B[m \u001B[1m(default-clean)\u001B[m @ \u001B[36mbuild-token-root\u001B[0;1m ---\u001B[m");
-                    listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] \u001B[1m------------------------------------------------------------------------\u001B[m");
-                    listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] \u001B[1;32mBUILD SUCCESS\u001B[m");
-                    return true;
-                }
-            });
-            FreeStyleBuild b = r.buildAndAssertSuccess(p);
-            StringWriter writer = new StringWriter();
-            assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
-            String html = writer.toString();
-            System.out.print(html);
-            assertThat(
-                html.replaceAll("<!--.+?-->", ""),
-                allOf(
-                    containsString("[<b><span style=\"color: #1E90FF;\">INFO</span></b>]"),
-                    containsString("<b>--------------&lt; </b><span style=\"color: #00CDCD;\">org.jenkins-ci.plugins:build-token-root</span><b> &gt;---------------</b>")
-                )
-            );
+    void maven(JenkinsRule jenkinsRule) throws Exception {
+        FreeStyleProject p = jenkinsRule.createFreeStyleProject();
+        p.getBuildWrappersList().add(new AnsiColorBuildWrapper(null));
+        p.getBuildersList().add(new TestBuilder() {
+            @Override
+            public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
+                // Like Maven 3.6.0 when using (MNG-6380) MAVEN_OPTS=-Djansi.force=true
+                listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] Scanning for projects...");
+                listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] ");
+                listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] \u001B[1m--------------< \u001B[0;36morg.jenkins-ci.plugins:build-token-root\u001B[0;1m >---------------\u001B[m");
+                listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] \u001B[1mBuilding Build Authorization Token Root Plugin 1.5-SNAPSHOT\u001B[m");
+                listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] \u001B[1m--------------------------------[ hpi ]---------------------------------\u001B[m");
+                listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] ");
+                listener.getLogger()
+                    .println(
+                        "[\u001B[1;34mINFO\u001B[m] \u001B[1m--- \u001B[0;32mmaven-clean-plugin:3.0.0:clean\u001B[m \u001B[1m(default-clean)\u001B[m @ \u001B[36mbuild-token-root\u001B[0;1m ---\u001B[m");
+                listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] \u001B[1m------------------------------------------------------------------------\u001B[m");
+                listener.getLogger().println("[\u001B[1;34mINFO\u001B[m] \u001B[1;32mBUILD SUCCESS\u001B[m");
+                return true;
+            }
         });
+        FreeStyleBuild b = jenkinsRule.buildAndAssertSuccess(p);
+        StringWriter writer = new StringWriter();
+        assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
+        String html = writer.toString();
+        System.out.print(html);
+        assertThat(
+            html.replaceAll("<!--.+?-->", ""),
+            allOf(
+                containsString("[<b><span style=\"color: #1E90FF;\">INFO</span></b>]"),
+                containsString("<b>--------------&lt; </b><span style=\"color: #00CDCD;\">org.jenkins-ci.plugins:build-token-root</span><b> &gt;---------------</b>")
+            )
+        );
     }
 
     @Test
-    public void testMultilineEscapeSequence() {
-        jenkinsRule.then(r -> {
-            FreeStyleProject p = r.createFreeStyleProject();
-            p.getBuildWrappersList().add(new AnsiColorBuildWrapper(null));
-            p.getBuildersList().add(new TestBuilder() {
-                @Override
-                public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
-                    listener.getLogger().println("\u001B[1;34mThis text should be bold and blue");
-                    listener.getLogger().println("Still bold and blue");
-                    listener.getLogger().println("\u001B[mThis text should be normal");
-                    return true;
-                }
-            });
-            FreeStyleBuild b = r.buildAndAssertSuccess(p);
-            StringWriter writer = new StringWriter();
-            assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
-            String html = writer.toString();
-            System.out.print(html);
-            String nl = System.lineSeparator();
-            assertThat(
-                html.replaceAll("<!--.+?-->", ""),
-                allOf(
-                    containsString("<b><span style=\"color: #1E90FF;\">This text should be bold and blue" + nl + "</span></b>"),
-                    containsString("<b><span style=\"color: #1E90FF;\">Still bold and blue" + nl + "</span></b>"),
-                    not(containsString("\u001B[m"))
-                )
-            );
+    void testMultilineEscapeSequence(JenkinsRule jenkinsRule) throws Exception {
+        FreeStyleProject p = jenkinsRule.createFreeStyleProject();
+        p.getBuildWrappersList().add(new AnsiColorBuildWrapper(null));
+        p.getBuildersList().add(new TestBuilder() {
+            @Override
+            public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
+                listener.getLogger().println("\u001B[1;34mThis text should be bold and blue");
+                listener.getLogger().println("Still bold and blue");
+                listener.getLogger().println("\u001B[mThis text should be normal");
+                return true;
+            }
         });
+        FreeStyleBuild b = jenkinsRule.buildAndAssertSuccess(p);
+        StringWriter writer = new StringWriter();
+        assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
+        String html = writer.toString();
+        System.out.print(html);
+        String nl = System.lineSeparator();
+        assertThat(
+            html.replaceAll("<!--.+?-->", ""),
+            allOf(
+                containsString("<b><span style=\"color: #1E90FF;\">This text should be bold and blue" + nl + "</span></b>"),
+                containsString("<b><span style=\"color: #1E90FF;\">Still bold and blue" + nl + "</span></b>"),
+                not(containsString("\u001B[m"))
+            )
+        );
     }
 
     @Test
-    public void testDefaultForegroundBackground() {
-        jenkinsRule.then(r -> {
-            FreeStyleProject p = r.createFreeStyleProject();
-            // The VGA ColorMap sets default foreground and background colors.
-            p.getBuildWrappersList().add(new AnsiColorBuildWrapper("vga"));
-            p.getBuildersList().add(new TestBuilder() {
-                @Override
-                public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
-                    listener.getLogger().println("White on black");
-                    listener.getLogger().println("\u001B[1;34mBold and blue on black");
-                    listener.getLogger().println("Still bold and blue on black\u001B[mBack to white on black");
-                    return true;
-                }
-            });
-            FreeStyleBuild b = r.buildAndAssertSuccess(p);
-            StringWriter writer = new StringWriter();
-            assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
-            String html = writer.toString();
-            System.out.print(html);
-            String nl = System.lineSeparator();
-            assertThat(
-                html.replaceAll("<!--.+?-->", ""),
-                allOf(
-                    containsString("<div style=\"background-color: #000000;color: #AAAAAA;\">White on black" + nl + "</div>"),
-                    containsString("<div style=\"background-color: #000000;color: #AAAAAA;\"><b><span style=\"color: #0000AA;\">Bold and blue on black" + nl + "</span></b></div>"),
-                    containsString(
-                        "<div style=\"background-color: #000000;color: #AAAAAA;\"><b><span style=\"color: #0000AA;\">Still bold and blue on black</span></b>Back to white on black" + nl + "</div>"
-                    )
-                )
-            );
+    void testDefaultForegroundBackground(JenkinsRule jenkinsRule) throws Exception {
+        FreeStyleProject p = jenkinsRule.createFreeStyleProject();
+        // The VGA ColorMap sets default foreground and background colors.
+        p.getBuildWrappersList().add(new AnsiColorBuildWrapper("vga"));
+        p.getBuildersList().add(new TestBuilder() {
+            @Override
+            public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
+                listener.getLogger().println("White on black");
+                listener.getLogger().println("\u001B[1;34mBold and blue on black");
+                listener.getLogger().println("Still bold and blue on black\u001B[mBack to white on black");
+                return true;
+            }
         });
+        FreeStyleBuild b = jenkinsRule.buildAndAssertSuccess(p);
+        StringWriter writer = new StringWriter();
+        assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
+        String html = writer.toString();
+        System.out.print(html);
+        String nl = System.lineSeparator();
+        assertThat(
+            html.replaceAll("<!--.+?-->", ""),
+            allOf(
+                containsString("<div style=\"background-color: #000000;color: #AAAAAA;\">White on black" + nl + "</div>"),
+                containsString("<div style=\"background-color: #000000;color: #AAAAAA;\"><b><span style=\"color: #0000AA;\">Bold and blue on black" + nl + "</span></b></div>"),
+                containsString(
+                    "<div style=\"background-color: #000000;color: #AAAAAA;\"><b><span style=\"color: #0000AA;\">Still bold and blue on black</span></b>Back to white on black" + nl + "</div>"
+                )
+            )
+        );
     }
 
     @Issue("JENKINS-54133")
     @Test
-    public void testWorkflowWrap() {
-        jenkinsRule.then(r -> {
-            Assume.assumeTrue(!Functions.isWindows());
-            jenkinsRule.j.createSlave();
-            WorkflowJob p = jenkinsRule.j.jenkins.createProject(WorkflowJob.class, "p");
-            p.setDefinition(new CpsFlowDefinition(
-                "node('!master') {\n"
-                    + "  wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {\n"
-                    + "    sh(\"\"\"#!/bin/bash\n"
-                    + "      printf 'The following word is supposed to be \\\\e[31mred\\\\e[0m\\\\n'\"\"\"\n"
-                    + "    )\n"
-                    + "  }\n"
-                    + "}"
-                , false
-            ));
-            jenkinsRule.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
-            StringWriter writer = new StringWriter();
-            assertTrue(p.getLastBuild().getLogText().writeHtmlTo(0L, writer) > 0);
-            String html = writer.toString();
-            assertTrue(
-                "Failed to match color attribute in following HTML log output:\n" + html,
-                html.replaceAll("<!--.+?-->", "").matches("(?s).*<span style=\"color: #CD0000;\">red</span>.*")
-            );
-        });
+    void testWorkflowWrap(JenkinsRule jenkinsRule) throws Exception {
+        assumeFalse(Functions.isWindows());
+        jenkinsRule.createSlave();
+        WorkflowJob p = jenkinsRule.jenkins.createProject(WorkflowJob.class, "p");
+        p.setDefinition(new CpsFlowDefinition(
+            "node('!master') {\n"
+                + "  wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {\n"
+                + "    sh(\"\"\"#!/bin/bash\n"
+                + "      printf 'The following word is supposed to be \\\\e[31mred\\\\e[0m\\\\n'\"\"\"\n"
+                + "    )\n"
+                + "  }\n"
+                + "}"
+            , false
+        ));
+        jenkinsRule.assertBuildStatusSuccess(p.scheduleBuild2(0));
+        StringWriter writer = new StringWriter();
+        assertTrue(p.getLastBuild().getLogText().writeHtmlTo(0L, writer) > 0);
+        String html = writer.toString();
+        assertTrue(
+            html.replaceAll("<!--.+?-->", "").matches("(?s).*<span style=\"color: #CD0000;\">red</span>.*"),
+            "Failed to match color attribute in following HTML log output:\n" + html
+        );
     }
 
     @Test
-    public void testNonAscii() {
-        jenkinsRule.then(r -> {
-            FreeStyleProject p = r.createFreeStyleProject();
-            p.getBuildWrappersList().add(new AnsiColorBuildWrapper(null));
-            p.getBuildersList().add(new TestBuilder() {
-                @Override
-                public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
-                    listener.getLogger().println("\033[94;1m[ INFO ] Récupération du numéro de version de l'application\033[0m");
-                    listener.getLogger().println("\033[94;1m[ INFO ] ビルドのコンソール出力を取得します。\033[0m");
-                    // There are 3 smiley face emojis in this String
-                    listener.getLogger().println("\033[94;1m[ INFO ] 😀😀\033[0m😀");
-                    return true;
-                }
-            });
-            FreeStyleBuild b = r.buildAndAssertSuccess(p);
-            StringWriter writer = new StringWriter();
-            assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
-            String html = writer.toString();
-            assertThat(
-                html.replaceAll("<!--.+?-->", ""),
-                allOf(
-                    containsString("<span style=\"color: #4682B4;\"><b>[ INFO ] Récupération du numéro de version de l'application</b></span>"),
-                    containsString("<span style=\"color: #4682B4;\"><b>[ INFO ] ビルドのコンソール出力を取得します。</b></span>"),
-                    containsString("<span style=\"color: #4682B4;\"><b>[ INFO ] 😀😀</b></span>😀")
-                )
-            );
+    void testNonAscii(JenkinsRule jenkinsRule) throws Exception {
+        FreeStyleProject p = jenkinsRule.createFreeStyleProject();
+        p.getBuildWrappersList().add(new AnsiColorBuildWrapper(null));
+        p.getBuildersList().add(new TestBuilder() {
+            @Override
+            public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
+                listener.getLogger().println("\033[94;1m[ INFO ] Récupération du numéro de version de l'application\033[0m");
+                listener.getLogger().println("\033[94;1m[ INFO ] ビルドのコンソール出力を取得します。\033[0m");
+                // There are 3 smiley face emojis in this String
+                listener.getLogger().println("\033[94;1m[ INFO ] 😀😀\033[0m😀");
+                return true;
+            }
         });
+        FreeStyleBuild b = jenkinsRule.buildAndAssertSuccess(p);
+        StringWriter writer = new StringWriter();
+        assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
+        String html = writer.toString();
+        assertThat(
+            html.replaceAll("<!--.+?-->", ""),
+            allOf(
+                containsString("<span style=\"color: #4682B4;\"><b>[ INFO ] Récupération du numéro de version de l'application</b></span>"),
+                containsString("<span style=\"color: #4682B4;\"><b>[ INFO ] ビルドのコンソール出力を取得します。</b></span>"),
+                containsString("<span style=\"color: #4682B4;\"><b>[ INFO ] 😀😀</b></span>😀")
+            )
+        );
     }
 
     @Issue("JENKINS-55139")
     @Test
-    public void testTerraform() {
-        jenkinsRule.then(r -> {
-            FreeStyleProject p = r.createFreeStyleProject();
-            p.getBuildWrappersList().add(new AnsiColorBuildWrapper(null));
-            p.getBuildersList().add(new TestBuilder() {
-                @Override
-                public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
-                    // Mimics terraform, c.f. `docker run --rm hashicorp/terraform plan 2>&1 | od -t a`
-                    listener.getLogger().println("\033[31m");
-                    listener.getLogger().println("\033[1m\033[31mError: \033[0m\033[0m\033[1mNo configuration files found!");
-                    listener.getLogger().println("bold text blurb\033[0m");
-                    listener.getLogger().println("\033[0m\033[0m\033[0m");
-                    return true;
-                }
-            });
-            FreeStyleBuild b = r.buildAndAssertSuccess(p);
-            StringWriter writer = new StringWriter();
-            assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
-            String html = writer.toString();
-            System.out.print(html);
-            assertThat(
-                html.replaceAll("<!--.+?-->", ""),
-                allOf(
-                    containsString("Error"),
-                    containsString("No configuration files found!"),
-                    not(containsString("\033[0m"))
-                )
-            );
+    void testTerraform(JenkinsRule jenkinsRule) throws Exception {
+        FreeStyleProject p = jenkinsRule.createFreeStyleProject();
+        p.getBuildWrappersList().add(new AnsiColorBuildWrapper(null));
+        p.getBuildersList().add(new TestBuilder() {
+            @Override
+            public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
+                // Mimics terraform, c.f. `docker run --rm hashicorp/terraform plan 2>&1 | od -t a`
+                listener.getLogger().println("\033[31m");
+                listener.getLogger().println("\033[1m\033[31mError: \033[0m\033[0m\033[1mNo configuration files found!");
+                listener.getLogger().println("bold text blurb\033[0m");
+                listener.getLogger().println("\033[0m\033[0m\033[0m");
+                return true;
+            }
         });
+        FreeStyleBuild b = jenkinsRule.buildAndAssertSuccess(p);
+        StringWriter writer = new StringWriter();
+        assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
+        String html = writer.toString();
+        System.out.print(html);
+        assertThat(
+            html.replaceAll("<!--.+?-->", ""),
+            allOf(
+                containsString("Error"),
+                containsString("No configuration files found!"),
+                not(containsString("\033[0m"))
+            )
+        );
     }
 
     @Issue("JENKINS-55139")
     @Test
-    public void testRedundantResets() {
-        jenkinsRule.then(r -> {
-            FreeStyleProject p = r.createFreeStyleProject();
-            p.getBuildWrappersList().add(new AnsiColorBuildWrapper(null));
-            p.getBuildersList().add(new TestBuilder() {
-                @Override
-                public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
-                    listener.getLogger().println("[Foo] \033[0m[\033[0m\033[0minfo\033[0m] \033[0m\033[0m\033[32m- this text is green\033[0m\033[0m");
-                    return true;
-                }
-            });
-            FreeStyleBuild b = r.buildAndAssertSuccess(p);
-            StringWriter writer = new StringWriter();
-            assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
-            String html = writer.toString();
-            System.out.print(html);
-            assertThat(
-                html.replaceAll("<!--.+?-->", ""),
-                allOf(
-                    containsString("[Foo]"),
-                    containsString("[info]"),
-                    containsString("<span style=\"color: #00CD00;\">- this text is green</span>"),
-                    not(containsString("\033[0m"))
-                )
-            );
+    void testRedundantResets(JenkinsRule jenkinsRule) throws Exception {
+        FreeStyleProject p = jenkinsRule.createFreeStyleProject();
+        p.getBuildWrappersList().add(new AnsiColorBuildWrapper(null));
+        p.getBuildersList().add(new TestBuilder() {
+            @Override
+            public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
+                listener.getLogger().println("[Foo] \033[0m[\033[0m\033[0minfo\033[0m] \033[0m\033[0m\033[32m- this text is green\033[0m\033[0m");
+                return true;
+            }
         });
+        FreeStyleBuild b = jenkinsRule.buildAndAssertSuccess(p);
+        StringWriter writer = new StringWriter();
+        assertTrue(b.getLogText().writeHtmlTo(0L, writer) > 0);
+        String html = writer.toString();
+        System.out.print(html);
+        assertThat(
+            html.replaceAll("<!--.+?-->", ""),
+            allOf(
+                containsString("[Foo]"),
+                containsString("[info]"),
+                containsString("<span style=\"color: #00CD00;\">- this text is green</span>"),
+                not(containsString("\033[0m"))
+            )
+        );
     }
 
     @Test
-    public void canWorkWithMovingSequences() {
+    void canWorkWithMovingSequences(JenkinsRule jenkinsRule) throws Exception {
         final String op1 = "Creating container_1";
         final String op2 = "Creating container_2";
         final String up2lines = csi(2, CSI.CUU);
@@ -335,6 +331,7 @@ public class AnsiColorBuildWrapperTest {
         };
 
         assertCorrectOutput(
+            jenkinsRule,
             Arrays.asList(op1 + " ... done", op2 + " ..."),
             Arrays.asList(up2lines, CLR, down2lines, back7chars, forward4chars),
             inputProvider
@@ -342,19 +339,14 @@ public class AnsiColorBuildWrapperTest {
     }
 
     @Test
-    public void canWorkWithVariousCsiSequences() {
+    void canWorkWithVariousCsiSequences(JenkinsRule jenkinsRule) throws Exception {
         final String txt0 = "Test various sequences begin";
-        final List<String> csiSequences = Arrays.stream(CSI.values()).map(csi -> {
-            switch (csi.paramsAmount) {
-                case 0:
-                    return csi(csi);
-                case 1:
-                    return csi(6, csi);
-                case 2:
-                    return csi(6, 4, csi);
-            }
-            throw new IllegalArgumentException("Not supported amount of params");
-        }).collect(Collectors.toList());
+        final List<String> csiSequences = Arrays.stream(CSI.values()).map(csi -> switch (csi.paramsAmount) {
+            case 0 -> csi(csi);
+            case 1 -> csi(6, csi);
+            case 2 -> csi(6, 4, csi);
+            default -> throw new IllegalArgumentException("Not supported amount of params");
+        }).toList();
         final String txt1 = "Test various sequences end";
         final Consumer<PrintStream> inputProvider = stream -> {
             stream.println(txt0);
@@ -362,12 +354,12 @@ public class AnsiColorBuildWrapperTest {
             stream.println(txt1);
         };
 
-        assertCorrectOutput(Arrays.asList(txt0, txt1), csiSequences, inputProvider);
+        assertCorrectOutput(jenkinsRule, Arrays.asList(txt0, txt1), csiSequences, inputProvider);
     }
 
     @Issue("172")
     @Test
-    public void canRenderSgrNormalIntensity() {
+    void canRenderSgrNormalIntensity(JenkinsRule jenkinsRule) throws Exception {
         final String sgrReset = sgr(0);
         final String msg0 = "lightgreen and reset sgr ";
         final String sgrLightGreen = sgr(92);
@@ -388,6 +380,7 @@ public class AnsiColorBuildWrapperTest {
             stream.println(sgrNormal + msg5 + sgrReset);
         };
         assertCorrectOutput(
+            jenkinsRule,
             Arrays.asList(
                 "<span style=\"color: #00FF00;\">" + msg0 + "</span>",
                 "<span style=\"color: #00FF00;\">" + msg1 + "</span>",
@@ -402,7 +395,7 @@ public class AnsiColorBuildWrapperTest {
     }
 
     @Test
-    public void canRenderSgrFaintIntensity() {
+    void canRenderSgrFaintIntensity(JenkinsRule jenkinsRule) throws Exception {
         final String sgrReset = sgr(0);
         final String msg0 = "lightblue and also faint";
         final String sgrLightBlueFaint = sgr(94, 2);
@@ -419,6 +412,7 @@ public class AnsiColorBuildWrapperTest {
             stream.println(sgrLightBlue + sgrFaint + sgrNormal + msg3 + sgrReset);
         };
         assertCorrectOutput(
+            jenkinsRule,
             Arrays.asList(
                 "<span style=\"color: #4682B4;\"><span style=\"font-weight: lighter;\">" + msg0 + "</span></span>",
                 "<span style=\"color: #4682B4;\">" + msg1 + "<span style=\"font-weight: lighter;\">" + msg2 + "</span></span>",
@@ -431,10 +425,11 @@ public class AnsiColorBuildWrapperTest {
 
     @Issue("158")
     @Test
-    public void canHandleSgrsWithMultipleOptions() {
+    void canHandleSgrsWithMultipleOptions(JenkinsRule jenkinsRule) throws Exception {
         final String input = "\u001B[33mbanana_1  |\u001B[0m 19:59:14.353\u001B[0;38m [debug] Lager installed handler {lager_file_backend,\"banana.log\"} into lager_event\u001B[0m\n";
         final Consumer<PrintStream> inputProvider = stream -> stream.println(input);
         assertCorrectOutput(
+            jenkinsRule,
             Collections.singletonList("<span style=\"color: #CDCD00;\">banana_1  |</span> 19:59:14.353 [debug] Lager installed handler {lager_file_backend,\"banana.log\"} into lager_event"),
             Collections.singletonList(ESC),
             inputProvider
@@ -443,10 +438,11 @@ public class AnsiColorBuildWrapperTest {
 
     @Issue("186")
     @Test
-    public void canHandleSgrsWithRgbColors() {
+    void canHandleSgrsWithRgbColors(JenkinsRule jenkinsRule) throws Exception {
         final String input = "\u001B[1;38;5;4m[fe1.k8sf.atom.us-west-2 ]\u001B[0m\n\u001B[1;38;5;13m[fe1b.k8sf.atom.us-east-2]\u001B[0m";
         final Consumer<PrintStream> inputProvider = stream -> stream.println(input);
         assertCorrectOutput(
+            jenkinsRule,
             Arrays.asList(
                 "<b><span style=\"color: #1E90FF;\">[fe1.k8sf.atom.us-west-2 ]</span></b>",
                 "<b><span style=\"color: #FF00FF;\">[fe1b.k8sf.atom.us-east-2]</span></b>"
@@ -476,12 +472,10 @@ public class AnsiColorBuildWrapperTest {
         return ESC + "[" + Arrays.stream(sgrParam).boxed().map(String::valueOf).collect(Collectors.joining(";")) + "m";
     }
 
-    private void assertCorrectOutput(Collection<String> expectedOutput, Collection<String> notExpectedOutput, Consumer<PrintStream> inputProvider) {
-        jenkinsRule.then(r -> {
-            final String html = runBuildWithPlugin(r, inputProvider).replaceAll("<!--.+?-->", "");
-            expectedOutput.forEach(s -> assertThat(html, containsString(s)));
-            notExpectedOutput.forEach(s -> assertThat("Test failed for sequence: " + s.replace(ESC, "ESC"), html, not(containsString(s))));
-        });
+    private void assertCorrectOutput(JenkinsRule rule, Collection<String> expectedOutput, Collection<String> notExpectedOutput, Consumer<PrintStream> inputProvider) throws Exception {
+        final String html = runBuildWithPlugin(rule, inputProvider).replaceAll("<!--.+?-->", "");
+        expectedOutput.forEach(s -> assertThat(html, containsString(s)));
+        notExpectedOutput.forEach(s -> assertThat("Test failed for sequence: " + s.replace(ESC, "ESC"), html, not(containsString(s))));
     }
 
     private String runBuildWithPlugin(JenkinsRule rule, Consumer<PrintStream> inputProvider) throws Exception {
@@ -501,24 +495,25 @@ public class AnsiColorBuildWrapperTest {
     }
 
 
-    @RunWith(MockitoJUnitRunner.class)
-    public static final class DescriptorImplTest {
+    @Nested
+    @WithJenkins
+    @ExtendWith(MockitoExtension.class)
+    class DescriptorImplTest {
         private AnsiColorBuildWrapper.DescriptorImpl descriptor;
 
         @Mock
         private StaplerRequest2 staplerRequest;
 
-        @Rule
-        public JenkinsRule jenkinsRule = new JenkinsRule();
-
+        private JenkinsRule jenkinsRule;
 
-        @Before
-        public void setUp() throws Exception {
+        @BeforeEach
+        public void setUp(JenkinsRule jenkinsRule) throws Exception {
+            this.jenkinsRule = jenkinsRule;
             descriptor = new AnsiColorBuildWrapper.DescriptorImpl();
         }
 
         @Test
-        public void canValidateCorrectInputData() throws Exception {
+        void canValidateCorrectInputData() throws Exception {
             final List<AnsiColorMap> ansiColorMaps = Arrays.asList(AnsiColorMap.XTerm, AnsiColorMap.CSS);
             final String globalMapName = "xterm";
             final String colorMap = "{'abc' : 123}";
@@ -531,12 +526,12 @@ public class AnsiColorBuildWrapperTest {
 
             assertTrue(descriptor.configure(staplerRequest, form));
             final List<AnsiColorMap> savedMaps = Arrays.asList(descriptor.getColorMaps());
-            ansiColorMaps.forEach(map -> assertTrue("Expected map no there: " + map, savedMaps.contains(map)));
+            ansiColorMaps.forEach(map -> assertTrue(savedMaps.contains(map), "Expected map no there: " + map));
             assertEquals(globalMapName, descriptor.getGlobalColorMapName());
         }
 
         @Test
-        public void emptyGlobalColorNameWontBeStored() throws Exception {
+        void emptyGlobalColorNameWontBeStored() throws Exception {
             final HashMap<String, String> formData = new HashMap<>();
             final String colorMap = "{'abc' : 123}";
             formData.put("colorMap", colorMap);
@@ -549,8 +544,8 @@ public class AnsiColorBuildWrapperTest {
             assertNull(descriptor.getGlobalColorMapName());
         }
 
-        @Test(expected = Descriptor.FormException.class)
-        public void wontAllowGlobalColorNameTooLong() throws Exception {
+        @Test
+        void wontAllowGlobalColorNameTooLong() throws Exception {
             final HashMap<String, String> formData = new HashMap<>();
             final String colorMap = "{'abc' : 123}";
             formData.put("colorMap", colorMap);
@@ -558,12 +553,13 @@ public class AnsiColorBuildWrapperTest {
             final JSONObject form = JSONObject.fromObject(formData);
             when(staplerRequest.getSubmittedForm()).thenReturn(form);
             when(staplerRequest.bindJSONToList(eq(AnsiColorMap.class), eq(colorMap))).thenReturn(Collections.emptyList());
+            assertThrows(Descriptor.FormException.class, () ->
 
-            descriptor.configure(staplerRequest, form);
+                descriptor.configure(staplerRequest, form));
         }
 
         @Test
-        public void wontAllowColorNameTooLong() throws Exception {
+        void wontAllowColorNameTooLong() throws Exception {
             final String tooLong = Strings.repeat('x', 257);
             assertAllColorMapsInvalid(new AnsiColorMap[]{
                 new AnsiColorMap(
@@ -575,8 +571,8 @@ public class AnsiColorBuildWrapperTest {
             });
         }
 
-        @Test(expected = Descriptor.FormException.class)
-        public void wontAllowGlobalColorNameNotMatchingOneColorMap() throws Exception {
+        @Test
+        void wontAllowGlobalColorNameNotMatchingOneColorMap() throws Exception {
             final List<AnsiColorMap> ansiColorMaps = Arrays.asList(AnsiColorMap.XTerm, AnsiColorMap.VGA);
             final HashMap<String, String> formData = new HashMap<>();
             final String colorMap = "{'abc' : 123}";
@@ -585,13 +581,14 @@ public class AnsiColorBuildWrapperTest {
             final JSONObject form = JSONObject.fromObject(formData);
             when(staplerRequest.getSubmittedForm()).thenReturn(form);
             when(staplerRequest.bindJSONToList(eq(AnsiColorMap.class), eq(colorMap))).thenReturn(ansiColorMaps);
+            assertThrows(Descriptor.FormException.class, () ->
 
-            descriptor.configure(staplerRequest, form);
+                descriptor.configure(staplerRequest, form));
         }
 
 
         @Test
-        public void wontAllowColorLiteralEmpty() throws Exception {
+        void wontAllowColorLiteralEmpty() throws Exception {
             final AnsiColorMap[] colorMapsEmptyColors = {
                 new AnsiColorMap(
                     "test-map",
@@ -694,7 +691,7 @@ public class AnsiColorBuildWrapperTest {
         }
 
         @Test
-        public void wontAllowColorLiteralTooLong() throws ServletException {
+        void wontAllowColorLiteralTooLong() throws ServletException {
             final String tooLong = Strings.repeat('a', 65);
             final AnsiColorMap[] colorMapsTooLongColors = {
                 new AnsiColorMap(
@@ -816,18 +813,14 @@ public class AnsiColorBuildWrapperTest {
 
         private void assertAllColorMapsInvalid(AnsiColorMap[] invalidColorMaps) throws ServletException {
             for (AnsiColorMap invalidColorMap : invalidColorMaps) {
-                try {
-                    final List<AnsiColorMap> ansiColorMaps = Arrays.asList(AnsiColorMap.XTerm, invalidColorMap);
-                    final HashMap<String, String> formData = new HashMap<>();
-                    final String colorMap = "{'abc' : 123}";
-                    formData.put("colorMap", colorMap);
-                    final JSONObject form = JSONObject.fromObject(formData);
-                    when(staplerRequest.getSubmittedForm()).thenReturn(form);
-                    when(staplerRequest.bindJSONToList(eq(AnsiColorMap.class), eq(colorMap))).thenReturn(ansiColorMaps);
-                    descriptor.configure(staplerRequest, form);
-                    fail("Invalid color map has not triggered exception: " + invalidColorMap);
-                } catch (Descriptor.FormException ignore) {
-                }
+                final List<AnsiColorMap> ansiColorMaps = Arrays.asList(AnsiColorMap.XTerm, invalidColorMap);
+                final HashMap<String, String> formData = new HashMap<>();
+                final String colorMap = "{'abc' : 123}";
+                formData.put("colorMap", colorMap);
+                final JSONObject form = JSONObject.fromObject(formData);
+                when(staplerRequest.getSubmittedForm()).thenReturn(form);
+                when(staplerRequest.bindJSONToList(eq(AnsiColorMap.class), eq(colorMap))).thenReturn(ansiColorMaps);
+                assertThrows(Descriptor.FormException.class, () -> descriptor.configure(staplerRequest, form), "Invalid color map has not triggered exception: " + invalidColorMap);
             }
         }
     }
diff --git a/src/test/java/hudson/plugins/ansicolor/AnsiColorMapTest.java b/src/test/java/hudson/plugins/ansicolor/AnsiColorMapTest.java
index 61480ee..5345088 100644
--- a/src/test/java/hudson/plugins/ansicolor/AnsiColorMapTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/AnsiColorMapTest.java
@@ -1,29 +1,31 @@
 package hudson.plugins.ansicolor;
 
 import hudson.util.XStream2;
+import org.junit.jupiter.api.Test;
+
 import java.io.InputStream;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import org.junit.Test;
 
-public class AnsiColorMapTest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+class AnsiColorMapTest {
 
     /*
     Ensure backwards compatibility with 0.4.1 format
     */
     @Test
-    public void testDeserialize_0_4_1() {
-        assertNotNull("Test file missing", getClass().getResource("/AnsiColorMap-0.4.1.xml"));
+    void testDeserialize_0_4_1() {
+        assertNotNull(getClass().getResource("/AnsiColorMap-0.4.1.xml"), "Test file missing");
 
         XStream2 xs2 = new XStream2();
         InputStream is = getClass().getResourceAsStream("/AnsiColorMap-0.4.1.xml");
         AnsiColorMap deserializedColorMap = (AnsiColorMap) xs2.fromXML(is);
-        
+
         AnsiColorMap colorMap = new AnsiColorMap("xterm",
-                "#000000", "#CD0000", "#00CD00", "#CDCD00", "#1E90FF", "#CD00CD", "#00CDCD", "#E5E5E5",
-                "#4C4C4C", "#FF0000", "#00FF00", "#FFFF00", "#4682B4", "#FF00FF", "#00FFFF", "#FFFFFF",
-                null, null);
-        
+            "#000000", "#CD0000", "#00CD00", "#CDCD00", "#1E90FF", "#CD00CD", "#00CDCD", "#E5E5E5",
+            "#4C4C4C", "#FF0000", "#00FF00", "#FFFF00", "#4682B4", "#FF00FF", "#00FFFF", "#FFFFFF",
+            null, null);
+
         assertEquals(deserializedColorMap, colorMap);
     }
 }
diff --git a/src/test/java/hudson/plugins/ansicolor/AnsiColorStepTest.java b/src/test/java/hudson/plugins/ansicolor/AnsiColorStepTest.java
index 8901118..1a48440 100644
--- a/src/test/java/hudson/plugins/ansicolor/AnsiColorStepTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/AnsiColorStepTest.java
@@ -12,63 +12,52 @@ import org.jenkinsci.plugins.workflow.job.WorkflowRun;
 import org.jenkinsci.plugins.workflow.log.TaskListenerDecorator;
 import org.jenkinsci.plugins.workflow.steps.DynamicContext;
 import org.jenkinsci.plugins.workflow.steps.StepDescriptor;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.jvnet.hudson.test.BuildWatcher;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 import org.jvnet.hudson.test.Issue;
-import org.jvnet.hudson.test.LoggerRule;
-import org.jvnet.hudson.test.RestartableJenkinsRule;
+import org.jvnet.hudson.test.JenkinsRule;
+import org.jvnet.hudson.test.junit.jupiter.WithJenkins;
 
 import java.io.StringWriter;
 import java.time.Duration;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
-import java.util.logging.Level;
 
 import static org.awaitility.Awaitility.await;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-public class AnsiColorStepTest {
-    @ClassRule
-    public static BuildWatcher buildWatcher = new BuildWatcher();
-    @Rule
-    public RestartableJenkinsRule jenkinsRule = new RestartableJenkinsRule();
-    @Rule
-    public LoggerRule logging = new LoggerRule().record(ColorConsoleAnnotator.class, Level.FINER);
+@WithJenkins
+class AnsiColorStepTest {
 
     @Test
-    public void testPipelineStep() {
-        jenkinsRule.then(r -> {
-            WorkflowJob p = jenkinsRule.j.jenkins.createProject(WorkflowJob.class, "p");
-            p.setDefinition(new CpsFlowDefinition(
-                "ansiColor('xterm') {\n"
-                    + "  echo 'The following word is supposed to be \\u001B[31mred\\u001B[0m'\n"
-                    + " echo \"TERM=${env.TERM}\""
-                    + "}"
-                , true));
-            WorkflowRun run = jenkinsRule.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
-            StringWriter writer = new StringWriter();
-            assertTrue(p.getLastBuild().getLogText().writeHtmlTo(0L, writer) > 0);
-            String html = writer.toString();
-            jenkinsRule.j.assertLogContains("TERM=xterm", run);
-            assertTrue(
-                "Failed to match color attribute in following HTML log output:\n" + html,
-                html.replaceAll("<!--.+?-->", "").matches("(?s).*<span style=\"color: #CD0000;\">red</span>.*")
-            );
-        });
+    void testPipelineStep(JenkinsRule jenkinsRule) throws Exception {
+        WorkflowJob p = jenkinsRule.jenkins.createProject(WorkflowJob.class, "p");
+        p.setDefinition(new CpsFlowDefinition(
+            "ansiColor('xterm') {\n"
+                + "  echo 'The following word is supposed to be \\u001B[31mred\\u001B[0m'\n"
+                + " echo \"TERM=${env.TERM}\""
+                + "}"
+            , true));
+        WorkflowRun run = jenkinsRule.assertBuildStatusSuccess(p.scheduleBuild2(0));
+        StringWriter writer = new StringWriter();
+        assertTrue(p.getLastBuild().getLogText().writeHtmlTo(0L, writer) > 0);
+        String html = writer.toString();
+        jenkinsRule.assertLogContains("TERM=xterm", run);
+        assertTrue(
+            html.replaceAll("<!--.+?-->", "").matches("(?s).*<span style=\"color: #CD0000;\">red</span>.*"),
+            "Failed to match color attribute in following HTML log output:\n" + html
+        );
     }
 
     @Issue("180")
     @Test
-    public void canRenderMultiplePipelineSteps() {
+    void canRenderMultiplePipelineSteps(JenkinsRule jenkinsRule) throws Exception {
         final String script = "echo '\033[32mbefore\033[0m'\n" +
             "ansiColor('vga') {\n" +
             "    echo '\033[32mstep one\033[0m'\n" +
@@ -84,6 +73,7 @@ public class AnsiColorStepTest {
             "echo '\033[32mafter step three\033[0m'";
 
         assertOutputOnRunningPipeline(
+            jenkinsRule,
             Arrays.asList(
                 "\033[32mbefore\033[0m",
                 "<span style=\"color: #00AA00;\">step one</span>",
@@ -108,13 +98,14 @@ public class AnsiColorStepTest {
 
     @Issue("JENKINS-61598")
     @Test
-    public void willNotLeakFormattingToMetadataLines() {
+    void willNotLeakFormattingToMetadataLines(JenkinsRule jenkinsRule) throws Exception {
         final String script = "ansiColor('xterm') {\n" +
             "    echo '\033[33mYellow words, white background.'\n" +
             "    echo '\033[35mMagenta words, white background.'\n" +
             "}";
         String nl = System.lineSeparator();
         assertOutputOnRunningPipeline(
+            jenkinsRule,
             Arrays.asList(
                 "<span style=\"color: #CDCD00;\">Yellow words, white background." + nl + "</span>",
                 "[Pipeline] echo",
@@ -131,61 +122,59 @@ public class AnsiColorStepTest {
         );
     }
 
-    @Ignore("TODO flaky test")
+    @Disabled("TODO flaky test")
     @Issue("200")
     @Test
-    public void canRenderLongOutputWhileBuildStillRunning() {
-        jenkinsRule.then(r -> {
-            final String a1k = JenkinsTestSupport.repeat("a", 1024);
-            final String script = "ansiColor('xterm') {\n" +
-                "for (i = 0; i < 1000; i++) {" +
-                "echo '\033[32m" + a1k + "\033[0m'\n" +
-                "}" +
-                "}";
-            final WorkflowJob project = jenkinsRule.j.jenkins.createProject(WorkflowJob.class, "canRenderLongOutputWhileBuildStillRunning");
-            project.setDefinition(new CpsFlowDefinition(script, true));
-            QueueTaskFuture<WorkflowRun> runFuture = project.scheduleBuild2(0);
-            assertNotNull(runFuture);
-            final WorkflowRun lastBuild = runFuture.waitForStart();
-            await().pollInterval(Duration.ofSeconds(5)).atMost(Duration.ofSeconds(150)).until(() -> {
-                StringWriter writer = new StringWriter();
-                final int skipInitialStartAction = 3000;
-                assertTrue(lastBuild.getLogText().writeHtmlTo(skipInitialStartAction, writer) > 0);
-                final String html = writer.toString().replaceAll("<!--.+?-->", "");
-                return !runFuture.isDone() && html.contains("<span style=\"color: #00CD00;\">" + a1k + "</span>") && !html.contains("\033[32m");
-            });
+    void canRenderLongOutputWhileBuildStillRunning(JenkinsRule jenkinsRule) throws Exception {
+        final String a1k = JenkinsTestSupport.repeat("a", 1024);
+        final String script = "ansiColor('xterm') {\n" +
+            "for (i = 0; i < 1000; i++) {" +
+            "echo '\033[32m" + a1k + "\033[0m'\n" +
+            "}" +
+            "}";
+        final WorkflowJob project = jenkinsRule.jenkins.createProject(WorkflowJob.class, "canRenderLongOutputWhileBuildStillRunning");
+        project.setDefinition(new CpsFlowDefinition(script, true));
+        QueueTaskFuture<WorkflowRun> runFuture = project.scheduleBuild2(0);
+        assertNotNull(runFuture);
+        final WorkflowRun lastBuild = runFuture.waitForStart();
+        await().pollInterval(Duration.ofSeconds(5)).atMost(Duration.ofSeconds(150)).until(() -> {
+            StringWriter writer = new StringWriter();
+            final int skipInitialStartAction = 3000;
+            assertTrue(lastBuild.getLogText().writeHtmlTo(skipInitialStartAction, writer) > 0);
+            final String html = writer.toString().replaceAll("<!--.+?-->", "");
+            return !runFuture.isDone() && html.contains("<span style=\"color: #00CD00;\">" + a1k + "</span>") && !html.contains("\033[32m");
         });
     }
 
     @Test
-    public void willPrintAdditionalNlOnKubernetesPlugin() {
+    void willPrintAdditionalNlOnKubernetesPlugin(JenkinsRule jenkinsRule) throws Exception {
         ExtensionList.lookup(DynamicContext.Typed.class).add(0, new SecretsMasker());
-        assertNlsOnRunningPipeline();
+        assertNlsOnRunningPipeline(jenkinsRule);
     }
 
     @Test
-    public void willPrintAdditionalNlOnTimestamperPlugin() {
+    void willPrintAdditionalNlOnTimestamperPlugin(JenkinsRule jenkinsRule) throws Exception {
         ExtensionList.lookup(TaskListenerDecorator.Factory.class).add(0, new GlobalDecorator());
-        assertNlsOnRunningPipeline();
+        assertNlsOnRunningPipeline(jenkinsRule);
     }
 
     @Issue("222")
     @Test
-    public void willPrintAdditionalNlOnLogstashPlugin() {
+    void willPrintAdditionalNlOnLogstashPlugin(JenkinsRule jenkinsRule) throws Exception {
         ExtensionList.lookup(TaskListenerDecorator.Factory.class).add(0, new hudson.plugins.ansicolor.mock.logstash.pipeline.GlobalDecorator());
-        assertNlsOnRunningPipeline();
+        assertNlsOnRunningPipeline(jenkinsRule);
     }
 
     @Issue("223")
     @Test
-    public void willPrintAdditionalNlOnPipelineMavenPlugin() {
+    void willPrintAdditionalNlOnPipelineMavenPlugin(JenkinsRule jenkinsRule) throws Exception {
         ExtensionList.lookup(StepDescriptor.class).add(0, new WithMavenStep.DescriptorImpl());
-        assertNlsOnRunningPipeline();
+        assertNlsOnRunningPipeline(jenkinsRule);
     }
 
     @Issue("218")
     @Test
-    public void canUseAndReportGlobalColorMapName() {
+    void canUseAndReportGlobalColorMapName(JenkinsRule jenkinsRule) throws Exception {
         final String globalColorMapName = "vga";
         final String script = "ansiColor {\n" +
             "    echo '\033[33mYellow words, white background.\033[0m'\n" +
@@ -199,32 +188,31 @@ public class AnsiColorStepTest {
             "\033[33mYellow words, white background.",
             "TERM=null"
         );
-        jenkinsRule.then(r -> {
-            Jenkins.get().getDescriptorByType(AnsiColorBuildWrapper.DescriptorImpl.class).setGlobalColorMapName(globalColorMapName);
+        Jenkins.get().getDescriptorByType(AnsiColorBuildWrapper.DescriptorImpl.class).setGlobalColorMapName(globalColorMapName);
 
-            final WorkflowJob project = jenkinsRule.j.jenkins.createProject(WorkflowJob.class, "p");
-            project.setDefinition(new CpsFlowDefinition(script, true));
-            jenkinsRule.j.assertBuildStatusSuccess(project.scheduleBuild2(0));
-            StringWriter writer = new StringWriter();
-            assertTrue(project.getLastBuild().getLogText().writeHtmlTo(0, writer) > 0);
-            final String html = writer.toString().replaceAll("<!--.+?-->", "");
-            for (String expected : expectedOutput) {
-                assertThat(html, containsString(expected));
-            }
-            for (String notExpected : notExpectedOutput) {
-                assertThat(html, not(containsString(notExpected)));
-            }
-        });
+        final WorkflowJob project = jenkinsRule.jenkins.createProject(WorkflowJob.class, "p");
+        project.setDefinition(new CpsFlowDefinition(script, true));
+        jenkinsRule.assertBuildStatusSuccess(project.scheduleBuild2(0));
+        StringWriter writer = new StringWriter();
+        assertTrue(project.getLastBuild().getLogText().writeHtmlTo(0, writer) > 0);
+        final String html = writer.toString().replaceAll("<!--.+?-->", "");
+        for (String expected : expectedOutput) {
+            assertThat(html, containsString(expected));
+        }
+        for (String notExpected : notExpectedOutput) {
+            assertThat(html, not(containsString(notExpected)));
+        }
     }
 
     @Issue("218")
     @Test
-    public void canUseAndReportDefaultColorMapName() {
+    void canUseAndReportDefaultColorMapName(JenkinsRule jenkinsRule) throws Exception {
         final String script = "ansiColor {\n" +
             "    echo '\033[33mYellow words, white background.\033[0m'\n" +
             "    echo \"TERM=${env.TERM}\"\n" +
             "}";
         assertOutputOnRunningPipeline(
+            jenkinsRule,
             Arrays.asList(
                 "<span style=\"color: #CDCD00;\">Yellow words, white background.</span>",
                 "TERM=xterm"
@@ -239,46 +227,42 @@ public class AnsiColorStepTest {
 
     @Issue("JENKINS-66684")
     @Test
-    public void canGetConstructorParametersForSnippetGenerator() {
+    void canGetConstructorParametersForSnippetGenerator(JenkinsRule jenkinsRule) {
         final String colorMapName = AnsiColorMap.VGA.getName();
         final AnsiColorStep step = new AnsiColorStep(colorMapName);
         assertEquals(colorMapName, step.getColorMapName());
     }
 
-    private void assertOutputOnRunningPipeline(Collection<String> expectedOutput, Collection<String> notExpectedOutput, String pipelineScript) {
-        jenkinsRule.then(r -> {
-            final WorkflowJob project = jenkinsRule.j.jenkins.createProject(WorkflowJob.class, "p");
-            project.setDefinition(new CpsFlowDefinition(pipelineScript, true));
-            jenkinsRule.j.assertBuildStatusSuccess(project.scheduleBuild2(0));
-            StringWriter writer = new StringWriter();
-            assertTrue(project.getLastBuild().getLogText().writeHtmlTo(0, writer) > 0);
-            final String html = writer.toString().replaceAll("<!--.+?-->", "");
-            for (String expected : expectedOutput) {
-                assertThat(html, containsString(expected));
-            }
-            for (String notExpected : notExpectedOutput) {
-                assertThat(html, not(containsString(notExpected)));
-            }
-        });
+    private void assertOutputOnRunningPipeline(JenkinsRule jenkinsRule, Collection<String> expectedOutput, Collection<String> notExpectedOutput, String pipelineScript) throws Exception {
+        final WorkflowJob project = jenkinsRule.jenkins.createProject(WorkflowJob.class, "p");
+        project.setDefinition(new CpsFlowDefinition(pipelineScript, true));
+        jenkinsRule.assertBuildStatusSuccess(project.scheduleBuild2(0));
+        StringWriter writer = new StringWriter();
+        assertTrue(project.getLastBuild().getLogText().writeHtmlTo(0, writer) > 0);
+        final String html = writer.toString().replaceAll("<!--.+?-->", "");
+        for (String expected : expectedOutput) {
+            assertThat(html, containsString(expected));
+        }
+        for (String notExpected : notExpectedOutput) {
+            assertThat(html, not(containsString(notExpected)));
+        }
     }
 
-    private void assertNlsOnRunningPipeline() {
-        jenkinsRule.then(r -> {
-            final String script = "ansiColor('xterm') {\n" +
-                "echo '\033[34mHello\033[0m \033[33mcolorful\033[0m \033[35mworld!\033[0m'" +
-                "}";
-            final WorkflowJob project = jenkinsRule.j.jenkins.createProject(WorkflowJob.class, "willPrintAdditionalNlOnKubernetesPlugin");
-            project.setDefinition(new CpsFlowDefinition(script, true));
-            jenkinsRule.j.assertBuildStatusSuccess(project.scheduleBuild2(0));
-            StringWriter writer = new StringWriter();
-            assertTrue(project.getLastBuild().getLogText().writeHtmlTo(0, writer) > 0);
-            final String html = writer.toString().replaceAll("<!--.+?-->", "")
-                .replaceAll("</span>", "")
-                .replaceAll("<span.+?>", "")
-                .replaceAll("<div.+?/div>", "");
-            final String nl = System.lineSeparator();
-            assertThat(html, containsString("ansiColor" + nl + "[Pipeline] {" + nl + nl));
-            assertThat(html, containsString("[Pipeline] }" + nl + nl + "[Pipeline] // ansiColor"));
-        });
+    private void assertNlsOnRunningPipeline(JenkinsRule jenkinsRule) throws Exception {
+        final String script = "ansiColor('xterm') {\n" +
+            "echo '\033[34mHello\033[0m \033[33mcolorful\033[0m \033[35mworld!\033[0m'" +
+            "}";
+        final WorkflowJob project = jenkinsRule.jenkins.createProject(WorkflowJob.class, "willPrintAdditionalNlOnKubernetesPlugin");
+        project.setDefinition(new CpsFlowDefinition(script, true));
+        jenkinsRule.assertBuildStatusSuccess(project.scheduleBuild2(0));
+        StringWriter writer = new StringWriter();
+        assertTrue(project.getLastBuild().getLogText().writeHtmlTo(0, writer) > 0);
+        final String html = writer.toString().replaceAll("<!--.+?-->", "")
+            .replaceAll("</span>", "")
+            .replaceAll("<span.+?>", "")
+            .replaceAll("<div.+?/div>", "");
+        final String nl = System.lineSeparator();
+        assertThat(html, containsString("ansiColor" + nl + "[Pipeline] {" + nl + nl));
+        assertThat(html, containsString("[Pipeline] }" + nl + nl + "[Pipeline] // ansiColor"));
     }
 }
diff --git a/src/test/java/hudson/plugins/ansicolor/AnsiHtmlOutputStreamTest.java b/src/test/java/hudson/plugins/ansicolor/AnsiHtmlOutputStreamTest.java
index 19084fd..32b70da 100644
--- a/src/test/java/hudson/plugins/ansicolor/AnsiHtmlOutputStreamTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/AnsiHtmlOutputStreamTest.java
@@ -24,9 +24,8 @@
 package hudson.plugins.ansicolor;
 
 import hudson.console.ConsoleNote;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import edu.umd.cs.findbugs.annotations.NonNull;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
@@ -34,30 +33,30 @@ import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 
-public class AnsiHtmlOutputStreamTest {
+class AnsiHtmlOutputStreamTest {
 
     @Test
-    public void testEmpty() throws IOException {
+    void testEmpty() throws IOException {
         assertThatAnnotateIs("", "");
     }
 
     @Test
-	public void testNoMarkup() throws IOException {
-		assertThatAnnotateIs("line", "line");
-	}
+    void testNoMarkup() throws IOException {
+        assertThatAnnotateIs("line", "line");
+    }
 
     @Test
-	public void testClearBlank() throws IOException {
-		assertThatAnnotateIs("\033[0m", "");
-	}
+    void testClearBlank() throws IOException {
+        assertThatAnnotateIs("\033[0m", "");
+    }
 
-	@Test
-	public void testClear() throws IOException {
+    @Test
+    void testClear() throws IOException {
         assertThatAnnotateIs("\033[0m\033[K", "");
-	}
+    }
 
     @Test
-    public void testConceal() throws IOException {
+    void testConceal() throws IOException {
         assertThatAnnotateIs(
             "there is concealed text here, \033[8mCONCEAL\033[0m, and it should vanish.",
             "there is concealed text here, , and it should vanish."
@@ -65,7 +64,7 @@ public class AnsiHtmlOutputStreamTest {
     }
 
     @Test
-    public void testEmbeddedConsoleNote() throws IOException {
+    void testEmbeddedConsoleNote() throws IOException {
         assertThatAnnotateIs(
             "there is a ConsoleNote here, \033[8mha:CONSOLENOTE\033[0m, and it should be left untouched.",
             "there is a ConsoleNote here, \033[8mha:CONSOLENOTE\033[0m, and it should be left untouched."
@@ -73,7 +72,7 @@ public class AnsiHtmlOutputStreamTest {
     }
 
     @Test
-    public void testConcealedConsoleNote() throws IOException {
+    void testConcealedConsoleNote() throws IOException {
         assertThatAnnotateIs(
             "there is a concealed note here, \033[8m\033[8mha:CONCEALEDCONSOLENOTE\033[0m\033[0m, " +
                 "and it should vanish.",
@@ -82,7 +81,7 @@ public class AnsiHtmlOutputStreamTest {
     }
 
     @Test
-    public void testConcealedConsoleNoteDoesNotUnconceal() throws IOException {
+    void testConcealedConsoleNoteDoesNotUnconceal() throws IOException {
         assertThatAnnotateIs(
             "there is a concealed note here, \033[8m\033[8mha:CONCEALEDCONSOLENOTE\033[0m, " +
                 "and it may not affect ongoing concealing.",
@@ -91,71 +90,71 @@ public class AnsiHtmlOutputStreamTest {
     }
 
     @Test
-    public void testBold() throws IOException {
+    void testBold() throws IOException {
         assertThatAnnotateIs("\033[1mhello world", "<b>hello world</b>");
     }
 
     @Test
-    public void testUnderline() throws IOException {
+    void testUnderline() throws IOException {
         assertThatAnnotateIs("\033[4mhello world", "<u>hello world</u>");
     }
 
     @Test
-    public void testUnderlineDouble() throws IOException {
+    void testUnderlineDouble() throws IOException {
         assertThatAnnotateIs("\033[21mhello world", "<span style=\"border-bottom: 3px double;\">hello world</span>");
     }
 
     @Test
-    public void testItalic() throws IOException {
+    void testItalic() throws IOException {
         assertThatAnnotateIs("\033[3mhello world\033[23mnormal", "<i>hello world</i>normal");
     }
 
     @Test
-    public void testNegative() throws IOException {
-       // simple tests
+    void testNegative() throws IOException {
+        // simple tests
         assertThatAnnotateIs(
-                "\033[7mon\033[moff",
-                "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\">on</span></span>off");
+            "\033[7mon\033[moff",
+            "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\">on</span></span>off");
 
         assertThatAnnotateIs(
-                "\033[7mon\033[27moff",
-                "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\">on</span></span>off");
+            "\033[7mon\033[27moff",
+            "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\">on</span></span>off");
 
         assertThatAnnotateIs(
-                "\033[33;7mon\033[27moff",
-                "<span style=\"color: #CDCD00;\"></span>" +                                                            // unnecessary <span> tag, could be removed …
+            "\033[33;7mon\033[27moff",
+            "<span style=\"color: #CDCD00;\"></span>" +                                                            // unnecessary <span> tag, could be removed …
                 "<span style=\"background-color: #CDCD00; color: #FFFFFF;\">on</span>" +
                 "<span style=\"color: #CDCD00;\">off</span>");
 
         assertThatAnnotateIs(
-                "\033[7;33mon\033[27moff",
-                "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\"></span></span>" +     // unnecessary <span> tag, could be removed …
+            "\033[7;33mon\033[27moff",
+            "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\"></span></span>" +     // unnecessary <span> tag, could be removed …
                 "<span style=\"color: #FFFFFF;\"><span style=\"background-color: #CDCD00;\">on</span></span>" +        // could be optimized to be a single <span> tag
                 "<span style=\"color: #CDCD00;\">off</span>");
 
         assertThatAnnotateIs(
-                "\033[41;7mon\033[27moff",
-                "<span style=\"background-color: #CD0000;\"></span>" +                                                 // unnecessary <span> tag, could be removed …
+            "\033[41;7mon\033[27moff",
+            "<span style=\"background-color: #CD0000;\"></span>" +                                                 // unnecessary <span> tag, could be removed …
                 "<span style=\"background-color: currentColor;\"><span style=\"color: #CD0000;\">on</span></span>" +
                 "<span style=\"background-color: #CD0000;\">off</span>");
 
         assertThatAnnotateIs(
-                "\033[7;41mon\033[27moff",
-                "<span style=\"background-color: currentColor;\">" +
-                  "<span style=\"color: #FFFFFF;\"></span>" +                                                          // unnecessary <span> tag, could be removed …
-                  "<span style=\"color: #CD0000;\">on</span>" +
+            "\033[7;41mon\033[27moff",
+            "<span style=\"background-color: currentColor;\">" +
+                "<span style=\"color: #FFFFFF;\"></span>" +                                                          // unnecessary <span> tag, could be removed …
+                "<span style=\"color: #CD0000;\">on</span>" +
                 "</span>" +
                 "<span style=\"background-color: #CD0000;\">off</span>");
 
         assertThatAnnotateIs(
-                "\033[33;41;7mon\033[27moff",
-                "<span style=\"color: #CDCD00;\"><span style=\"background-color: #CD0000;\"></span></span>" +          // unnecessary <span> tag, could be removed …
+            "\033[33;41;7mon\033[27moff",
+            "<span style=\"color: #CDCD00;\"><span style=\"background-color: #CD0000;\"></span></span>" +          // unnecessary <span> tag, could be removed …
                 "<span style=\"background-color: #CDCD00; color: #CD0000;\">on</span>" +
                 "<span style=\"background-color: #CD0000; color: #CDCD00;\">off</span>");
 
         assertThatAnnotateIs(
-                "\033[7;33;41mon\033[27moff",
-                "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\"></span></span>" +     // unnecessary <span> tag, could be removed …
+            "\033[7;33;41mon\033[27moff",
+            "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\"></span></span>" +     // unnecessary <span> tag, could be removed …
                 "<span style=\"color: #FFFFFF;\"><span style=\"background-color: #CDCD00;\"></span></span>" +          // unnecessary <span> tag, could be removed …
                 "<span style=\"background-color: #CDCD00;\"><span style=\"color: #CD0000;\">on</span></span>" +        // could be optimized to be a single <span> tag
                 "<span style=\"background-color: #CD0000; color: #CDCD00;\">off</span>");
@@ -163,191 +162,191 @@ public class AnsiHtmlOutputStreamTest {
 
         // reset foreground / background to default while [7m is active
         assertThatAnnotateIs(
-                "\033[33;7mon\033[39mdefault",
-                "<span style=\"color: #CDCD00;\"></span>" +                                                            // unnecessary <span> tag, could be removed …
+            "\033[33;7mon\033[39mdefault",
+            "<span style=\"color: #CDCD00;\"></span>" +                                                            // unnecessary <span> tag, could be removed …
                 "<span style=\"background-color: #CDCD00; color: #FFFFFF;\">on</span>" +
                 "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\">default</span></span>");
 
         assertThatAnnotateIs(
-                "\033[7;33mon\033[39mdefault",
-                "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\"></span></span>" +     // unnecessary <span> tag, could be removed …
+            "\033[7;33mon\033[39mdefault",
+            "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\"></span></span>" +     // unnecessary <span> tag, could be removed …
                 "<span style=\"color: #FFFFFF;\"><span style=\"background-color: #CDCD00;\">on</span></span>" +        // could be optimized to be a single <span> tag
                 "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\">default</span></span>");
 
         assertThatAnnotateIs(
-                "\033[41;7mon\033[49mdefault",
-                "<span style=\"background-color: #CD0000;\"></span>" +                                                 // unnecessary <span> tag, could be removed …
+            "\033[41;7mon\033[49mdefault",
+            "<span style=\"background-color: #CD0000;\"></span>" +                                                 // unnecessary <span> tag, could be removed …
                 "<span style=\"background-color: currentColor;\">" +
-                  "<span style=\"color: #CD0000;\">on</span>" +
-                  "<span style=\"color: #FFFFFF;\">default</span>" +
+                "<span style=\"color: #CD0000;\">on</span>" +
+                "<span style=\"color: #FFFFFF;\">default</span>" +
                 "</span>");
 
         assertThatAnnotateIs(
-                "\033[7;41mon\033[49mdefault",
-                "<span style=\"background-color: currentColor;\">" +
-                  "<span style=\"color: #FFFFFF;\"></span>" +                                                          // unnecessary <span> tag, could be removed …
-                  "<span style=\"color: #CD0000;\">on</span>" +
-                  "<span style=\"color: #FFFFFF;\">default</span>" +
+            "\033[7;41mon\033[49mdefault",
+            "<span style=\"background-color: currentColor;\">" +
+                "<span style=\"color: #FFFFFF;\"></span>" +                                                          // unnecessary <span> tag, could be removed …
+                "<span style=\"color: #CD0000;\">on</span>" +
+                "<span style=\"color: #FFFFFF;\">default</span>" +
                 "</span>");
 
         assertThatAnnotateIs(
-                "\033[33;41;7mon\033[39mdefault",
-                "<span style=\"color: #CDCD00;\"><span style=\"background-color: #CD0000;\"></span></span>" +          // unnecessary <span> tag, could be removed …
+            "\033[33;41;7mon\033[39mdefault",
+            "<span style=\"color: #CDCD00;\"><span style=\"background-color: #CD0000;\"></span></span>" +          // unnecessary <span> tag, could be removed …
                 "<span style=\"background-color: #CDCD00; color: #CD0000;\">on</span>" +
                 "<span style=\"background-color: currentColor;\"><span style=\"color: #CD0000;\">default</span></span>");
 
         assertThatAnnotateIs(
-                "\033[7;33;41mon\033[39mdefault",
-                "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\"></span></span>" +     // unnecessary <span> tag, could be removed …
+            "\033[7;33;41mon\033[39mdefault",
+            "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\"></span></span>" +     // unnecessary <span> tag, could be removed …
                 "<span style=\"color: #FFFFFF;\"><span style=\"background-color: #CDCD00;\"></span></span>" +          // unnecessary <span> tag, could be removed …
                 "<span style=\"background-color: #CDCD00;\"><span style=\"color: #CD0000;\">on</span></span>" +
                 "<span style=\"background-color: currentColor;\"><span style=\"color: #CD0000;\">default</span></span>");
 
         assertThatAnnotateIs(
-                "\033[33;41;7mon\033[49mdefault",
-                "<span style=\"color: #CDCD00;\"><span style=\"background-color: #CD0000;\"></span></span>" +          // unnecessary <span> tag, could be removed …
+            "\033[33;41;7mon\033[49mdefault",
+            "<span style=\"color: #CDCD00;\"><span style=\"background-color: #CD0000;\"></span></span>" +          // unnecessary <span> tag, could be removed …
                 "<span style=\"background-color: #CDCD00; color: #CD0000;\">" +
-                  "on" +
-                  "<span style=\"color: #FFFFFF;\">default</span>" +
+                "on" +
+                "<span style=\"color: #FFFFFF;\">default</span>" +
                 "</span>");
 
         assertThatAnnotateIs(
-                "\033[7;33;41mon\033[49mdefault",
-                "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\"></span></span>" +     // unnecessary <span> tag, could be removed …
+            "\033[7;33;41mon\033[49mdefault",
+            "<span style=\"background-color: currentColor;\"><span style=\"color: #FFFFFF;\"></span></span>" +     // unnecessary <span> tag, could be removed …
                 "<span style=\"color: #FFFFFF;\"><span style=\"background-color: #CDCD00;\"></span></span>" +          // unnecessary <span> tag, could be removed …
                 "<span style=\"background-color: #CDCD00;\">" +
-                  "<span style=\"color: #CD0000;\">on</span>" +
-                  "<span style=\"color: #FFFFFF;\">default</span>" +
+                "<span style=\"color: #CD0000;\">on</span>" +
+                "<span style=\"color: #FFFFFF;\">default</span>" +
                 "</span>");
 
 
         // simple tests with dark theme, as there has been default foreground / background colors defined (in contrast to xterm scheme)
         assertThatAnnotateIs(AnsiColorMap.VGA,
-                "\033[7mon\033[moff",
-                "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
-                  "<span style=\"background-color: #AAAAAA; color: #000000;\">on</span>off" +
+            "\033[7mon\033[moff",
+            "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
+                "<span style=\"background-color: #AAAAAA; color: #000000;\">on</span>off" +
                 "</div>");
 
         assertThatAnnotateIs(AnsiColorMap.VGA,
-                "\033[7mon\033[27moff",
-                "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
-                  "<span style=\"background-color: #AAAAAA; color: #000000;\">on</span>off" +
+            "\033[7mon\033[27moff",
+            "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
+                "<span style=\"background-color: #AAAAAA; color: #000000;\">on</span>off" +
                 "</div>");
 
         assertThatAnnotateIs(AnsiColorMap.VGA,
-                "\033[33;7mon\033[27moff",
-                "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
-                  "<span style=\"color: #AA5500;\"></span>" +                                                          // unnecessary <span> tag, could be removed …
-                  "<span style=\"background-color: #AA5500; color: #000000;\">on</span>" +
-                  "<span style=\"color: #AA5500;\">off</span>" +
+            "\033[33;7mon\033[27moff",
+            "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
+                "<span style=\"color: #AA5500;\"></span>" +                                                          // unnecessary <span> tag, could be removed …
+                "<span style=\"background-color: #AA5500; color: #000000;\">on</span>" +
+                "<span style=\"color: #AA5500;\">off</span>" +
                 "</div>");
 
         assertThatAnnotateIs(AnsiColorMap.VGA,
-                "\033[7;33mon\033[27moff",
-                "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
-                  "<span style=\"background-color: #AAAAAA; color: #000000;\">" +                                      // unnecessary <span> tag, could be removed / merged with the following <span>
-                    "<span style=\"background-color: #AA5500;\">on</span>" +
-                  "</span>" +
-                  "<span style=\"color: #AA5500;\">off</span>" +
+            "\033[7;33mon\033[27moff",
+            "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
+                "<span style=\"background-color: #AAAAAA; color: #000000;\">" +                                      // unnecessary <span> tag, could be removed / merged with the following <span>
+                "<span style=\"background-color: #AA5500;\">on</span>" +
+                "</span>" +
+                "<span style=\"color: #AA5500;\">off</span>" +
                 "</div>");
 
         assertThatAnnotateIs(AnsiColorMap.VGA,
-                "\033[41;7mon\033[27moff",
-                "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
-                  "<span style=\"background-color: #AA0000;\"></span>" +                                               // unnecessary <span> tag, could be removed …
-                  "<span style=\"background-color: #AAAAAA; color: #AA0000;\">on</span>" +
-                  "<span style=\"background-color: #AA0000;\">off</span>" +
+            "\033[41;7mon\033[27moff",
+            "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
+                "<span style=\"background-color: #AA0000;\"></span>" +                                               // unnecessary <span> tag, could be removed …
+                "<span style=\"background-color: #AAAAAA; color: #AA0000;\">on</span>" +
+                "<span style=\"background-color: #AA0000;\">off</span>" +
                 "</div>");
 
         assertThatAnnotateIs(AnsiColorMap.VGA,
-                "\033[7;41mon\033[27moff",
-                "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
-                  "<span style=\"background-color: #AAAAAA; color: #000000;\">" +                                      // unnecessary <span> tag, could be removed / merged with the following <span>
-                    "<span style=\"color: #AA0000;\">on</span>" +
-                  "</span>" +
-                  "<span style=\"background-color: #AA0000;\">off</span>" +
+            "\033[7;41mon\033[27moff",
+            "<div style=\"background-color: #000000;color: #AAAAAA;\">" +
+                "<span style=\"background-color: #AAAAAA; color: #000000;\">" +                                      // unnecessary <span> tag, could be removed / merged with the following <span>
+                "<span style=\"color: #AA0000;\">on</span>" +
+                "</span>" +
+                "<span style=\"background-color: #AA0000;\">off</span>" +
                 "</div>");
 
 
         // a bit more stress
         assertThatAnnotateIs(
-                "\033[33;41m" + "yellow on red, " +
-                "\033[7m"     + "now inverse, " +
-                "\033[7m"     + "one more [7m should change nothing, " +
-                "\033[27m"    + "turned back to non inverse",
-                "<span style=\"color: #CDCD00;\"><span style=\"background-color: #CD0000;\">yellow on red, </span></span>" +     // could be optimized to be a single <span> tag
+            "\033[33;41m" + "yellow on red, " +
+                "\033[7m" + "now inverse, " +
+                "\033[7m" + "one more [7m should change nothing, " +
+                "\033[27m" + "turned back to non inverse",
+            "<span style=\"color: #CDCD00;\"><span style=\"background-color: #CD0000;\">yellow on red, </span></span>" +     // could be optimized to be a single <span> tag
                 "<span style=\"background-color: #CDCD00; color: #CD0000;\">now inverse, one more [7m should change nothing, </span>" +
                 "<span style=\"background-color: #CD0000; color: #CDCD00;\">turned back to non inverse</span>");
 
         assertThatAnnotateIs(
-                "\033[33;41m" + "yellow on red, " +
-                "\033[7m"     + "now inverse, " +
-                "\033[30m"    + "[30m → red on black, " +
-                "\033[103m"   + "[103m  → yellow on black, " +
-                "\033[27m"    + "[27m → black on yellow",
-                "<span style=\"color: #CDCD00;\"><span style=\"background-color: #CD0000;\">yellow on red, </span></span>" +     // could be optimized to be a single <span> tag
+            "\033[33;41m" + "yellow on red, " +
+                "\033[7m" + "now inverse, " +
+                "\033[30m" + "[30m → red on black, " +
+                "\033[103m" + "[103m  → yellow on black, " +
+                "\033[27m" + "[27m → black on yellow",
+            "<span style=\"color: #CDCD00;\"><span style=\"background-color: #CD0000;\">yellow on red, </span></span>" +     // could be optimized to be a single <span> tag
                 "<span style=\"background-color: #CDCD00; color: #CD0000;\">" +
-                  "now inverse, " +
-                  "<span style=\"background-color: #000000;\">" +
-                    "[30m → red on black, " +
-                    "<span style=\"color: #FFFF00;\">" +
-                      "[103m  → yellow on black, " +
-                    "</span>" +
-                  "</span>" +
+                "now inverse, " +
+                "<span style=\"background-color: #000000;\">" +
+                "[30m → red on black, " +
+                "<span style=\"color: #FFFF00;\">" +
+                "[103m  → yellow on black, " +
+                "</span>" +
+                "</span>" +
                 "</span>" +
                 "<span style=\"background-color: #FFFF00; color: #000000;\">[27m → black on yellow</span>");
     }
 
     @Test
-    public void testStrikeout() throws IOException {
+    void testStrikeout() throws IOException {
         assertThatAnnotateIs("\033[9mhello world\033[29mnormal", "<span style=\"text-decoration: line-through;\">hello world</span>normal");
     }
 
     @Test
-    public void testFramed() throws IOException {
+    void testFramed() throws IOException {
         assertThatAnnotateIs("\033[51mhello world\033[54mnormal", "<span style=\"border: 1px solid;\">hello world</span>normal");
     }
 
     @Test
-    public void testOverlined() throws IOException {
+    void testOverlined() throws IOException {
         assertThatAnnotateIs("\033[53mhello world\033[55mnormal", "<span style=\"text-decoration: overline;\">hello world</span>normal");
     }
 
     @Test
-    public void testGreen() throws IOException {
+    void testGreen() throws IOException {
         assertThatAnnotateIs("\033[32mhello world", "<span style=\"color: #00CD00;\">hello world</span>");
     }
 
     @Test
-    public void testGreenXTerm() throws IOException {
+    void testGreenXTerm() throws IOException {
         assertThat(annotate("\033[32mhello world", AnsiColorMap.XTerm),
             is("<span style=\"color: "
                 + AnsiColorMap.XTerm.getGreen() + ";\">hello world</span>"));
     }
 
     @Test
-    public void testGreenCSS() throws IOException {
+    void testGreenCSS() throws IOException {
         assertThat(annotate("\033[32mhello world", AnsiColorMap.CSS),
             is("<span style=\"color: green;\">hello world</span>"));
     }
 
 
     @Test
-    public void testGreenOnWhite() throws IOException {
+    void testGreenOnWhite() throws IOException {
         assertThat(
             annotate("\033[47;32mhello world"),
             is("<span style=\"background-color: #E5E5E5;\"><span style=\"color: #00CD00;\">hello world</span></span>"));
     }
 
     @Test
-    public void testGreenOnWhiteCSS() throws IOException {
+    void testGreenOnWhiteCSS() throws IOException {
         assertThat(
             annotate("\033[47;32mhello world", AnsiColorMap.CSS),
             is("<span style=\"background-color: white;\"><span style=\"color: green;\">hello world</span></span>"));
     }
 
     @Test
-    public void testGreenOnWhiteXTerm() throws IOException {
+    void testGreenOnWhiteXTerm() throws IOException {
         assertThat(
             annotate("\033[47;32mhello world", AnsiColorMap.XTerm),
             is("<span style=\"background-color: "
@@ -356,226 +355,225 @@ public class AnsiHtmlOutputStreamTest {
     }
 
     @Test
-    public void testResetForegroundColor() throws IOException {
+    void testResetForegroundColor() throws IOException {
         assertThatAnnotateIs("\033[32mtic\033[1mtac\033[39mtoe",
-                "<span style=\"color: #00CD00;\">tic<b>tac</b></span><b>toe</b>");
+            "<span style=\"color: #00CD00;\">tic<b>tac</b></span><b>toe</b>");
     }
 
     @Test
-    public void testForegroundColorHighIntensity() throws IOException {
-        assertThatAnnotateIs("\033[90mDark gray\033[0m"    , "<span style=\"color: #4C4C4C;\">Dark gray</span>");
-        assertThatAnnotateIs("\033[91mLight red\033[0m"    , "<span style=\"color: #FF0000;\">Light red</span>");
-        assertThatAnnotateIs("\033[92mLight green\033[0m"  , "<span style=\"color: #00FF00;\">Light green</span>");
-        assertThatAnnotateIs("\033[93mLight yellow\033[0m" , "<span style=\"color: #FFFF00;\">Light yellow</span>");
-        assertThatAnnotateIs("\033[94mLight blue\033[0m"   , "<span style=\"color: #4682B4;\">Light blue</span>");
+    void testForegroundColorHighIntensity() throws IOException {
+        assertThatAnnotateIs("\033[90mDark gray\033[0m", "<span style=\"color: #4C4C4C;\">Dark gray</span>");
+        assertThatAnnotateIs("\033[91mLight red\033[0m", "<span style=\"color: #FF0000;\">Light red</span>");
+        assertThatAnnotateIs("\033[92mLight green\033[0m", "<span style=\"color: #00FF00;\">Light green</span>");
+        assertThatAnnotateIs("\033[93mLight yellow\033[0m", "<span style=\"color: #FFFF00;\">Light yellow</span>");
+        assertThatAnnotateIs("\033[94mLight blue\033[0m", "<span style=\"color: #4682B4;\">Light blue</span>");
         assertThatAnnotateIs("\033[95mLight magenta\033[0m", "<span style=\"color: #FF00FF;\">Light magenta</span>");
-        assertThatAnnotateIs("\033[96mLight cyan\033[0m"   , "<span style=\"color: #00FFFF;\">Light cyan</span>");
-        assertThatAnnotateIs("\033[97mWhite\033[0m"        , "<span style=\"color: #FFFFFF;\">White</span>");
+        assertThatAnnotateIs("\033[96mLight cyan\033[0m", "<span style=\"color: #00FFFF;\">Light cyan</span>");
+        assertThatAnnotateIs("\033[97mWhite\033[0m", "<span style=\"color: #FFFFFF;\">White</span>");
     }
 
     @Test
-    public void testForegroundColor256() throws IOException {
+    void testForegroundColor256() throws IOException {
         // standard colors 0-15
-        assertThatAnnotateIs("\033[38;5;0mBlack\033[0m"         , "<span style=\"color: #000000;\">Black</span>");
-        assertThatAnnotateIs("\033[38;5;1mRed\033[0m"           , "<span style=\"color: #CD0000;\">Red</span>");
-        assertThatAnnotateIs("\033[38;5;2mGreen\033[0m"         , "<span style=\"color: #00CD00;\">Green</span>");
-        assertThatAnnotateIs("\033[38;5;3mYellow\033[0m"        , "<span style=\"color: #CDCD00;\">Yellow</span>");
-        assertThatAnnotateIs("\033[38;5;4mBlue\033[0m"          , "<span style=\"color: #1E90FF;\">Blue</span>");
-        assertThatAnnotateIs("\033[38;5;5mMagenta\033[0m"       , "<span style=\"color: #CD00CD;\">Magenta</span>");
-        assertThatAnnotateIs("\033[38;5;6mCyan\033[0m"          , "<span style=\"color: #00CDCD;\">Cyan</span>");
-        assertThatAnnotateIs("\033[38;5;7mGray\033[0m"          , "<span style=\"color: #E5E5E5;\">Gray</span>");
-        assertThatAnnotateIs("\033[38;5;8mDark gray\033[0m"     , "<span style=\"color: #4C4C4C;\">Dark gray</span>");
-        assertThatAnnotateIs("\033[38;5;9mLight red\033[0m"     , "<span style=\"color: #FF0000;\">Light red</span>");
-        assertThatAnnotateIs("\033[38;5;10mLight green\033[0m"  , "<span style=\"color: #00FF00;\">Light green</span>");
-        assertThatAnnotateIs("\033[38;5;11mLight yellow\033[0m" , "<span style=\"color: #FFFF00;\">Light yellow</span>");
-        assertThatAnnotateIs("\033[38;5;12mLight blue\033[0m"   , "<span style=\"color: #4682B4;\">Light blue</span>");
+        assertThatAnnotateIs("\033[38;5;0mBlack\033[0m", "<span style=\"color: #000000;\">Black</span>");
+        assertThatAnnotateIs("\033[38;5;1mRed\033[0m", "<span style=\"color: #CD0000;\">Red</span>");
+        assertThatAnnotateIs("\033[38;5;2mGreen\033[0m", "<span style=\"color: #00CD00;\">Green</span>");
+        assertThatAnnotateIs("\033[38;5;3mYellow\033[0m", "<span style=\"color: #CDCD00;\">Yellow</span>");
+        assertThatAnnotateIs("\033[38;5;4mBlue\033[0m", "<span style=\"color: #1E90FF;\">Blue</span>");
+        assertThatAnnotateIs("\033[38;5;5mMagenta\033[0m", "<span style=\"color: #CD00CD;\">Magenta</span>");
+        assertThatAnnotateIs("\033[38;5;6mCyan\033[0m", "<span style=\"color: #00CDCD;\">Cyan</span>");
+        assertThatAnnotateIs("\033[38;5;7mGray\033[0m", "<span style=\"color: #E5E5E5;\">Gray</span>");
+        assertThatAnnotateIs("\033[38;5;8mDark gray\033[0m", "<span style=\"color: #4C4C4C;\">Dark gray</span>");
+        assertThatAnnotateIs("\033[38;5;9mLight red\033[0m", "<span style=\"color: #FF0000;\">Light red</span>");
+        assertThatAnnotateIs("\033[38;5;10mLight green\033[0m", "<span style=\"color: #00FF00;\">Light green</span>");
+        assertThatAnnotateIs("\033[38;5;11mLight yellow\033[0m", "<span style=\"color: #FFFF00;\">Light yellow</span>");
+        assertThatAnnotateIs("\033[38;5;12mLight blue\033[0m", "<span style=\"color: #4682B4;\">Light blue</span>");
         assertThatAnnotateIs("\033[38;5;13mLight magenta\033[0m", "<span style=\"color: #FF00FF;\">Light magenta</span>");
-        assertThatAnnotateIs("\033[38;5;14mLight cyan\033[0m"   , "<span style=\"color: #00FFFF;\">Light cyan</span>");
-        assertThatAnnotateIs("\033[38;5;15mWhite\033[0m"        , "<span style=\"color: #FFFFFF;\">White</span>");
+        assertThatAnnotateIs("\033[38;5;14mLight cyan\033[0m", "<span style=\"color: #00FFFF;\">Light cyan</span>");
+        assertThatAnnotateIs("\033[38;5;15mWhite\033[0m", "<span style=\"color: #FFFFFF;\">White</span>");
 
         // some of the 6x6x6=216 color cube
-        assertThatAnnotateIs("\033[38;5;16mABC\033[0m"          , "<span style=\"color: #000000;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;21mABC\033[0m"          , "<span style=\"color: #0000FF;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;196mABC\033[0m"         , "<span style=\"color: #FF0000;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;201mABC\033[0m"         , "<span style=\"color: #FF00FF;\">ABC</span>");
-
-        assertThatAnnotateIs("\033[38;5;22mABC\033[0m"          , "<span style=\"color: #005F00;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;27mABC\033[0m"          , "<span style=\"color: #005FFF;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;202mABC\033[0m"         , "<span style=\"color: #FF5F00;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;207mABC\033[0m"         , "<span style=\"color: #FF5FFF;\">ABC</span>");
-
-        assertThatAnnotateIs("\033[38;5;28mABC\033[0m"          , "<span style=\"color: #008700;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;33mABC\033[0m"          , "<span style=\"color: #0087FF;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;208mABC\033[0m"         , "<span style=\"color: #FF8700;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;213mABC\033[0m"         , "<span style=\"color: #FF87FF;\">ABC</span>");
-
-        assertThatAnnotateIs("\033[38;5;34mABC\033[0m"          , "<span style=\"color: #00AF00;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;39mABC\033[0m"          , "<span style=\"color: #00AFFF;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;214mABC\033[0m"         , "<span style=\"color: #FFAF00;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;219mABC\033[0m"         , "<span style=\"color: #FFAFFF;\">ABC</span>");
-
-        assertThatAnnotateIs("\033[38;5;40mABC\033[0m"          , "<span style=\"color: #00D700;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;45mABC\033[0m"          , "<span style=\"color: #00D7FF;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;220mABC\033[0m"         , "<span style=\"color: #FFD700;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;225mABC\033[0m"         , "<span style=\"color: #FFD7FF;\">ABC</span>");
-
-        assertThatAnnotateIs("\033[38;5;46mABC\033[0m"          , "<span style=\"color: #00FF00;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;51mABC\033[0m"          , "<span style=\"color: #00FFFF;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;226mABC\033[0m"         , "<span style=\"color: #FFFF00;\">ABC</span>");
-        assertThatAnnotateIs("\033[38;5;231mABC\033[0m"         , "<span style=\"color: #FFFFFF;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;16mABC\033[0m", "<span style=\"color: #000000;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;21mABC\033[0m", "<span style=\"color: #0000FF;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;196mABC\033[0m", "<span style=\"color: #FF0000;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;201mABC\033[0m", "<span style=\"color: #FF00FF;\">ABC</span>");
+
+        assertThatAnnotateIs("\033[38;5;22mABC\033[0m", "<span style=\"color: #005F00;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;27mABC\033[0m", "<span style=\"color: #005FFF;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;202mABC\033[0m", "<span style=\"color: #FF5F00;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;207mABC\033[0m", "<span style=\"color: #FF5FFF;\">ABC</span>");
+
+        assertThatAnnotateIs("\033[38;5;28mABC\033[0m", "<span style=\"color: #008700;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;33mABC\033[0m", "<span style=\"color: #0087FF;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;208mABC\033[0m", "<span style=\"color: #FF8700;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;213mABC\033[0m", "<span style=\"color: #FF87FF;\">ABC</span>");
+
+        assertThatAnnotateIs("\033[38;5;34mABC\033[0m", "<span style=\"color: #00AF00;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;39mABC\033[0m", "<span style=\"color: #00AFFF;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;214mABC\033[0m", "<span style=\"color: #FFAF00;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;219mABC\033[0m", "<span style=\"color: #FFAFFF;\">ABC</span>");
+
+        assertThatAnnotateIs("\033[38;5;40mABC\033[0m", "<span style=\"color: #00D700;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;45mABC\033[0m", "<span style=\"color: #00D7FF;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;220mABC\033[0m", "<span style=\"color: #FFD700;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;225mABC\033[0m", "<span style=\"color: #FFD7FF;\">ABC</span>");
+
+        assertThatAnnotateIs("\033[38;5;46mABC\033[0m", "<span style=\"color: #00FF00;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;51mABC\033[0m", "<span style=\"color: #00FFFF;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;226mABC\033[0m", "<span style=\"color: #FFFF00;\">ABC</span>");
+        assertThatAnnotateIs("\033[38;5;231mABC\033[0m", "<span style=\"color: #FFFFFF;\">ABC</span>");
 
         // some of the 24 gray shades
-        assertThatAnnotateIs("\033[38;5;232mGray\033[0m"        , "<span style=\"color: #080808;\">Gray</span>");
-        assertThatAnnotateIs("\033[38;5;240mGray\033[0m"        , "<span style=\"color: #585858;\">Gray</span>");
-        assertThatAnnotateIs("\033[38;5;248mGray\033[0m"        , "<span style=\"color: #A8A8A8;\">Gray</span>");
-        assertThatAnnotateIs("\033[38;5;255mGray\033[0m"        , "<span style=\"color: #EEEEEE;\">Gray</span>");
+        assertThatAnnotateIs("\033[38;5;232mGray\033[0m", "<span style=\"color: #080808;\">Gray</span>");
+        assertThatAnnotateIs("\033[38;5;240mGray\033[0m", "<span style=\"color: #585858;\">Gray</span>");
+        assertThatAnnotateIs("\033[38;5;248mGray\033[0m", "<span style=\"color: #A8A8A8;\">Gray</span>");
+        assertThatAnnotateIs("\033[38;5;255mGray\033[0m", "<span style=\"color: #EEEEEE;\">Gray</span>");
     }
 
     @Test
-    public void testForegroundColorRgb() throws IOException {
-        assertThatAnnotateIs("\033[38;2;0;0;0mBlack\033[0m"      , "<span style=\"color: #000000;\">Black</span>");
-        assertThatAnnotateIs("\033[38;2;255;0;0mRed\033[0m"      , "<span style=\"color: #FF0000;\">Red</span>");
-        assertThatAnnotateIs("\033[38;2;0;255;0mGreen\033[0m"    , "<span style=\"color: #00FF00;\">Green</span>");
-        assertThatAnnotateIs("\033[38;2;255;255;0mYellow\033[0m" , "<span style=\"color: #FFFF00;\">Yellow</span>");
-        assertThatAnnotateIs("\033[38;2;0;0;255mBlue\033[0m"     , "<span style=\"color: #0000FF;\">Blue</span>");
+    void testForegroundColorRgb() throws IOException {
+        assertThatAnnotateIs("\033[38;2;0;0;0mBlack\033[0m", "<span style=\"color: #000000;\">Black</span>");
+        assertThatAnnotateIs("\033[38;2;255;0;0mRed\033[0m", "<span style=\"color: #FF0000;\">Red</span>");
+        assertThatAnnotateIs("\033[38;2;0;255;0mGreen\033[0m", "<span style=\"color: #00FF00;\">Green</span>");
+        assertThatAnnotateIs("\033[38;2;255;255;0mYellow\033[0m", "<span style=\"color: #FFFF00;\">Yellow</span>");
+        assertThatAnnotateIs("\033[38;2;0;0;255mBlue\033[0m", "<span style=\"color: #0000FF;\">Blue</span>");
         assertThatAnnotateIs("\033[38;2;255;0;255mMagenta\033[0m", "<span style=\"color: #FF00FF;\">Magenta</span>");
-        assertThatAnnotateIs("\033[38;2;0;255;255mCyan\033[0m"   , "<span style=\"color: #00FFFF;\">Cyan</span>");
+        assertThatAnnotateIs("\033[38;2;0;255;255mCyan\033[0m", "<span style=\"color: #00FFFF;\">Cyan</span>");
         assertThatAnnotateIs("\033[38;2;255;255;255mWhite\033[0m", "<span style=\"color: #FFFFFF;\">White</span>");
-        assertThatAnnotateIs("\033[38;2;128;128;128mGray\033[0m" , "<span style=\"color: #808080;\">Gray</span>");
+        assertThatAnnotateIs("\033[38;2;128;128;128mGray\033[0m", "<span style=\"color: #808080;\">Gray</span>");
     }
 
     @Test
-    public void testResetBackgroundColor() throws IOException {
+    void testResetBackgroundColor() throws IOException {
         assertThatAnnotateIs("\033[42mtic\033[1mtac\033[49mtoe",
-                "<span style=\"background-color: #00CD00;\">tic<b>tac</b></span><b>toe</b>");
+            "<span style=\"background-color: #00CD00;\">tic<b>tac</b></span><b>toe</b>");
     }
 
     @Test
-    public void testBackgroundColorHighIntensity() throws IOException {
-        assertThatAnnotateIs("\033[100mDark gray\033[0m"    , "<span style=\"background-color: #4C4C4C;\">Dark gray</span>");
-        assertThatAnnotateIs("\033[101mLight red\033[0m"    , "<span style=\"background-color: #FF0000;\">Light red</span>");
-        assertThatAnnotateIs("\033[102mLight green\033[0m"  , "<span style=\"background-color: #00FF00;\">Light green</span>");
-        assertThatAnnotateIs("\033[103mLight yellow\033[0m" , "<span style=\"background-color: #FFFF00;\">Light yellow</span>");
-        assertThatAnnotateIs("\033[104mLight blue\033[0m"   , "<span style=\"background-color: #4682B4;\">Light blue</span>");
+    void testBackgroundColorHighIntensity() throws IOException {
+        assertThatAnnotateIs("\033[100mDark gray\033[0m", "<span style=\"background-color: #4C4C4C;\">Dark gray</span>");
+        assertThatAnnotateIs("\033[101mLight red\033[0m", "<span style=\"background-color: #FF0000;\">Light red</span>");
+        assertThatAnnotateIs("\033[102mLight green\033[0m", "<span style=\"background-color: #00FF00;\">Light green</span>");
+        assertThatAnnotateIs("\033[103mLight yellow\033[0m", "<span style=\"background-color: #FFFF00;\">Light yellow</span>");
+        assertThatAnnotateIs("\033[104mLight blue\033[0m", "<span style=\"background-color: #4682B4;\">Light blue</span>");
         assertThatAnnotateIs("\033[105mLight magenta\033[0m", "<span style=\"background-color: #FF00FF;\">Light magenta</span>");
-        assertThatAnnotateIs("\033[106mLight cyan\033[0m"   , "<span style=\"background-color: #00FFFF;\">Light cyan</span>");
-        assertThatAnnotateIs("\033[107mWhite\033[0m"        , "<span style=\"background-color: #FFFFFF;\">White</span>");
+        assertThatAnnotateIs("\033[106mLight cyan\033[0m", "<span style=\"background-color: #00FFFF;\">Light cyan</span>");
+        assertThatAnnotateIs("\033[107mWhite\033[0m", "<span style=\"background-color: #FFFFFF;\">White</span>");
     }
 
     @Test
-    public void testBackgroundColor256() throws IOException {
+    void testBackgroundColor256() throws IOException {
         // mainly copied code from testForegroundColor256()
         // standard colors 0-15
-        assertThatAnnotateIs("\033[48;5;0mBlack\033[0m"         , "<span style=\"background-color: #000000;\">Black</span>");
-        assertThatAnnotateIs("\033[48;5;1mRed\033[0m"           , "<span style=\"background-color: #CD0000;\">Red</span>");
-        assertThatAnnotateIs("\033[48;5;2mGreen\033[0m"         , "<span style=\"background-color: #00CD00;\">Green</span>");
-        assertThatAnnotateIs("\033[48;5;3mYellow\033[0m"        , "<span style=\"background-color: #CDCD00;\">Yellow</span>");
-        assertThatAnnotateIs("\033[48;5;4mBlue\033[0m"          , "<span style=\"background-color: #1E90FF;\">Blue</span>");
-        assertThatAnnotateIs("\033[48;5;5mMagenta\033[0m"       , "<span style=\"background-color: #CD00CD;\">Magenta</span>");
-        assertThatAnnotateIs("\033[48;5;6mCyan\033[0m"          , "<span style=\"background-color: #00CDCD;\">Cyan</span>");
-        assertThatAnnotateIs("\033[48;5;7mGray\033[0m"          , "<span style=\"background-color: #E5E5E5;\">Gray</span>");
-        assertThatAnnotateIs("\033[48;5;8mDark gray\033[0m"     , "<span style=\"background-color: #4C4C4C;\">Dark gray</span>");
-        assertThatAnnotateIs("\033[48;5;9mLight red\033[0m"     , "<span style=\"background-color: #FF0000;\">Light red</span>");
-        assertThatAnnotateIs("\033[48;5;10mLight green\033[0m"  , "<span style=\"background-color: #00FF00;\">Light green</span>");
-        assertThatAnnotateIs("\033[48;5;11mLight yellow\033[0m" , "<span style=\"background-color: #FFFF00;\">Light yellow</span>");
-        assertThatAnnotateIs("\033[48;5;12mLight blue\033[0m"   , "<span style=\"background-color: #4682B4;\">Light blue</span>");
+        assertThatAnnotateIs("\033[48;5;0mBlack\033[0m", "<span style=\"background-color: #000000;\">Black</span>");
+        assertThatAnnotateIs("\033[48;5;1mRed\033[0m", "<span style=\"background-color: #CD0000;\">Red</span>");
+        assertThatAnnotateIs("\033[48;5;2mGreen\033[0m", "<span style=\"background-color: #00CD00;\">Green</span>");
+        assertThatAnnotateIs("\033[48;5;3mYellow\033[0m", "<span style=\"background-color: #CDCD00;\">Yellow</span>");
+        assertThatAnnotateIs("\033[48;5;4mBlue\033[0m", "<span style=\"background-color: #1E90FF;\">Blue</span>");
+        assertThatAnnotateIs("\033[48;5;5mMagenta\033[0m", "<span style=\"background-color: #CD00CD;\">Magenta</span>");
+        assertThatAnnotateIs("\033[48;5;6mCyan\033[0m", "<span style=\"background-color: #00CDCD;\">Cyan</span>");
+        assertThatAnnotateIs("\033[48;5;7mGray\033[0m", "<span style=\"background-color: #E5E5E5;\">Gray</span>");
+        assertThatAnnotateIs("\033[48;5;8mDark gray\033[0m", "<span style=\"background-color: #4C4C4C;\">Dark gray</span>");
+        assertThatAnnotateIs("\033[48;5;9mLight red\033[0m", "<span style=\"background-color: #FF0000;\">Light red</span>");
+        assertThatAnnotateIs("\033[48;5;10mLight green\033[0m", "<span style=\"background-color: #00FF00;\">Light green</span>");
+        assertThatAnnotateIs("\033[48;5;11mLight yellow\033[0m", "<span style=\"background-color: #FFFF00;\">Light yellow</span>");
+        assertThatAnnotateIs("\033[48;5;12mLight blue\033[0m", "<span style=\"background-color: #4682B4;\">Light blue</span>");
         assertThatAnnotateIs("\033[48;5;13mLight magenta\033[0m", "<span style=\"background-color: #FF00FF;\">Light magenta</span>");
-        assertThatAnnotateIs("\033[48;5;14mLight cyan\033[0m"   , "<span style=\"background-color: #00FFFF;\">Light cyan</span>");
-        assertThatAnnotateIs("\033[48;5;15mWhite\033[0m"        , "<span style=\"background-color: #FFFFFF;\">White</span>");
+        assertThatAnnotateIs("\033[48;5;14mLight cyan\033[0m", "<span style=\"background-color: #00FFFF;\">Light cyan</span>");
+        assertThatAnnotateIs("\033[48;5;15mWhite\033[0m", "<span style=\"background-color: #FFFFFF;\">White</span>");
 
         // some of the 6x6x6=216 color cube
-        assertThatAnnotateIs("\033[48;5;16mABC\033[0m"          , "<span style=\"background-color: #000000;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;21mABC\033[0m"          , "<span style=\"background-color: #0000FF;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;196mABC\033[0m"         , "<span style=\"background-color: #FF0000;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;201mABC\033[0m"         , "<span style=\"background-color: #FF00FF;\">ABC</span>");
-
-        assertThatAnnotateIs("\033[48;5;22mABC\033[0m"          , "<span style=\"background-color: #005F00;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;27mABC\033[0m"          , "<span style=\"background-color: #005FFF;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;202mABC\033[0m"         , "<span style=\"background-color: #FF5F00;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;207mABC\033[0m"         , "<span style=\"background-color: #FF5FFF;\">ABC</span>");
-
-        assertThatAnnotateIs("\033[48;5;28mABC\033[0m"          , "<span style=\"background-color: #008700;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;33mABC\033[0m"          , "<span style=\"background-color: #0087FF;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;208mABC\033[0m"         , "<span style=\"background-color: #FF8700;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;213mABC\033[0m"         , "<span style=\"background-color: #FF87FF;\">ABC</span>");
-
-        assertThatAnnotateIs("\033[48;5;34mABC\033[0m"          , "<span style=\"background-color: #00AF00;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;39mABC\033[0m"          , "<span style=\"background-color: #00AFFF;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;214mABC\033[0m"         , "<span style=\"background-color: #FFAF00;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;219mABC\033[0m"         , "<span style=\"background-color: #FFAFFF;\">ABC</span>");
-
-        assertThatAnnotateIs("\033[48;5;40mABC\033[0m"          , "<span style=\"background-color: #00D700;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;45mABC\033[0m"          , "<span style=\"background-color: #00D7FF;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;220mABC\033[0m"         , "<span style=\"background-color: #FFD700;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;225mABC\033[0m"         , "<span style=\"background-color: #FFD7FF;\">ABC</span>");
-
-        assertThatAnnotateIs("\033[48;5;46mABC\033[0m"          , "<span style=\"background-color: #00FF00;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;51mABC\033[0m"          , "<span style=\"background-color: #00FFFF;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;226mABC\033[0m"         , "<span style=\"background-color: #FFFF00;\">ABC</span>");
-        assertThatAnnotateIs("\033[48;5;231mABC\033[0m"         , "<span style=\"background-color: #FFFFFF;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;16mABC\033[0m", "<span style=\"background-color: #000000;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;21mABC\033[0m", "<span style=\"background-color: #0000FF;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;196mABC\033[0m", "<span style=\"background-color: #FF0000;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;201mABC\033[0m", "<span style=\"background-color: #FF00FF;\">ABC</span>");
+
+        assertThatAnnotateIs("\033[48;5;22mABC\033[0m", "<span style=\"background-color: #005F00;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;27mABC\033[0m", "<span style=\"background-color: #005FFF;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;202mABC\033[0m", "<span style=\"background-color: #FF5F00;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;207mABC\033[0m", "<span style=\"background-color: #FF5FFF;\">ABC</span>");
+
+        assertThatAnnotateIs("\033[48;5;28mABC\033[0m", "<span style=\"background-color: #008700;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;33mABC\033[0m", "<span style=\"background-color: #0087FF;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;208mABC\033[0m", "<span style=\"background-color: #FF8700;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;213mABC\033[0m", "<span style=\"background-color: #FF87FF;\">ABC</span>");
+
+        assertThatAnnotateIs("\033[48;5;34mABC\033[0m", "<span style=\"background-color: #00AF00;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;39mABC\033[0m", "<span style=\"background-color: #00AFFF;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;214mABC\033[0m", "<span style=\"background-color: #FFAF00;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;219mABC\033[0m", "<span style=\"background-color: #FFAFFF;\">ABC</span>");
+
+        assertThatAnnotateIs("\033[48;5;40mABC\033[0m", "<span style=\"background-color: #00D700;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;45mABC\033[0m", "<span style=\"background-color: #00D7FF;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;220mABC\033[0m", "<span style=\"background-color: #FFD700;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;225mABC\033[0m", "<span style=\"background-color: #FFD7FF;\">ABC</span>");
+
+        assertThatAnnotateIs("\033[48;5;46mABC\033[0m", "<span style=\"background-color: #00FF00;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;51mABC\033[0m", "<span style=\"background-color: #00FFFF;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;226mABC\033[0m", "<span style=\"background-color: #FFFF00;\">ABC</span>");
+        assertThatAnnotateIs("\033[48;5;231mABC\033[0m", "<span style=\"background-color: #FFFFFF;\">ABC</span>");
 
         // some of the 24 gray shades
-        assertThatAnnotateIs("\033[48;5;232mGray\033[0m"        , "<span style=\"background-color: #080808;\">Gray</span>");
-        assertThatAnnotateIs("\033[48;5;240mGray\033[0m"        , "<span style=\"background-color: #585858;\">Gray</span>");
-        assertThatAnnotateIs("\033[48;5;248mGray\033[0m"        , "<span style=\"background-color: #A8A8A8;\">Gray</span>");
-        assertThatAnnotateIs("\033[48;5;255mGray\033[0m"        , "<span style=\"background-color: #EEEEEE;\">Gray</span>");
+        assertThatAnnotateIs("\033[48;5;232mGray\033[0m", "<span style=\"background-color: #080808;\">Gray</span>");
+        assertThatAnnotateIs("\033[48;5;240mGray\033[0m", "<span style=\"background-color: #585858;\">Gray</span>");
+        assertThatAnnotateIs("\033[48;5;248mGray\033[0m", "<span style=\"background-color: #A8A8A8;\">Gray</span>");
+        assertThatAnnotateIs("\033[48;5;255mGray\033[0m", "<span style=\"background-color: #EEEEEE;\">Gray</span>");
     }
 
     @Test
-    public void testBackgroundColorRgb() throws IOException {
+    void testBackgroundColorRgb() throws IOException {
         // mainly copied code from testForegroundColorRgb()
-        assertThatAnnotateIs("\033[48;2;0;0;0mBlack\033[0m"      , "<span style=\"background-color: #000000;\">Black</span>");
-        assertThatAnnotateIs("\033[48;2;255;0;0mRed\033[0m"      , "<span style=\"background-color: #FF0000;\">Red</span>");
-        assertThatAnnotateIs("\033[48;2;0;255;0mGreen\033[0m"    , "<span style=\"background-color: #00FF00;\">Green</span>");
-        assertThatAnnotateIs("\033[48;2;255;255;0mYellow\033[0m" , "<span style=\"background-color: #FFFF00;\">Yellow</span>");
-        assertThatAnnotateIs("\033[48;2;0;0;255mBlue\033[0m"     , "<span style=\"background-color: #0000FF;\">Blue</span>");
+        assertThatAnnotateIs("\033[48;2;0;0;0mBlack\033[0m", "<span style=\"background-color: #000000;\">Black</span>");
+        assertThatAnnotateIs("\033[48;2;255;0;0mRed\033[0m", "<span style=\"background-color: #FF0000;\">Red</span>");
+        assertThatAnnotateIs("\033[48;2;0;255;0mGreen\033[0m", "<span style=\"background-color: #00FF00;\">Green</span>");
+        assertThatAnnotateIs("\033[48;2;255;255;0mYellow\033[0m", "<span style=\"background-color: #FFFF00;\">Yellow</span>");
+        assertThatAnnotateIs("\033[48;2;0;0;255mBlue\033[0m", "<span style=\"background-color: #0000FF;\">Blue</span>");
         assertThatAnnotateIs("\033[48;2;255;0;255mMagenta\033[0m", "<span style=\"background-color: #FF00FF;\">Magenta</span>");
-        assertThatAnnotateIs("\033[48;2;0;255;255mCyan\033[0m"   , "<span style=\"background-color: #00FFFF;\">Cyan</span>");
+        assertThatAnnotateIs("\033[48;2;0;255;255mCyan\033[0m", "<span style=\"background-color: #00FFFF;\">Cyan</span>");
         assertThatAnnotateIs("\033[48;2;255;255;255mWhite\033[0m", "<span style=\"background-color: #FFFFFF;\">White</span>");
-        assertThatAnnotateIs("\033[48;2;128;128;128mGray\033[0m" , "<span style=\"background-color: #808080;\">Gray</span>");
+        assertThatAnnotateIs("\033[48;2;128;128;128mGray\033[0m", "<span style=\"background-color: #808080;\">Gray</span>");
     }
 
     @Test
-    public void testDefaultColors() throws IOException {
+    void testDefaultColors() throws IOException {
         assertThat(
-                annotate("\033[32mtic\033[1mtac\033[39mtoe", AnsiColorMap.VGA),
-                is("<div style=\"background-color: #000000;color: #AAAAAA;\">" +
-                        "<span style=\"color: #00AA00;\">tic<b>tac</b></span><b>toe</b>" +
-                        "</div>"));
+            annotate("\033[32mtic\033[1mtac\033[39mtoe", AnsiColorMap.VGA),
+            is("<div style=\"background-color: #000000;color: #AAAAAA;\">" +
+                "<span style=\"color: #00AA00;\">tic<b>tac</b></span><b>toe</b>" +
+                "</div>"));
     }
 
 
     @Test
-    public void testConsoleNote() throws IOException {
+    void testConsoleNote() throws IOException {
         assertThat(
             annotate(ConsoleNote.PREAMBLE_STR + "hello world" + ConsoleNote.POSTAMBLE_STR),
             is(ConsoleNote.PREAMBLE_STR + "hello world" + ConsoleNote.POSTAMBLE_STR));
     }
 
     @Test
-    public void testResetOnOpen() throws IOException {
+    void testResetOnOpen() throws IOException {
         assertThat(
             annotate("\033[0;31;49mred\033[0m"),
-            is("" +
-                "<span style=\"color: #CD0000;\">red" +
+            is("<span style=\"color: #CD0000;\">red" +
                 "</span>")
         );
     }
 
     @Test
-    public void testUnicode() throws IOException {
+    void testUnicode() throws IOException {
         assertThatAnnotateIs("\033[32mmünchen", "<span style=\"color: #00CD00;\">münchen</span>");
     }
 
     @Test
-    public void testJapanese() throws IOException {
+    void testJapanese() throws IOException {
         assertThatAnnotateIs("\033[32mこんにちは", "<span style=\"color: #00CD00;\">こんにちは</span>");
     }
 
     @Test
-    public void testOverlapping() throws IOException {
+    void testOverlapping() throws IOException {
         assertThatAnnotateIs("plain\033[32mgreen\033[1mboldgreen\033[4mulboldgreen\033[31mulboldred" +
-            "\033[22mulred\033[24mred",
+                "\033[22mulred\033[24mred",
             "plain" +
                 "<span style=\"color: #00CD00;\">" +                    // +green
                 "green" +
@@ -595,13 +593,13 @@ public class AnsiHtmlOutputStreamTest {
     }
 
     @Test
-    public void testResetCharacterSet() throws IOException {
+    void testResetCharacterSet() throws IOException {
         assertThatAnnotateIs("(\033(0)", "()");
         assertThatAnnotateIs("(\033)0)", "()");
     }
 
     @Test
-    public void testFontDefault() throws IOException {
+    void testFontDefault() throws IOException {
         assertThatAnnotateIs("(\033[10m)", "()");
     }
 
@@ -615,13 +613,11 @@ public class AnsiHtmlOutputStreamTest {
 
     private String annotate(String text, AnsiColorMap colorMap) throws IOException {
         final ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        AnsiHtmlOutputStream ansi = new AnsiHtmlOutputStream(bos, colorMap, new AnsiAttributeElement.Emitter() {
-            public void emitHtml(@NonNull String html) {
-                try {
-                    bos.write(html.getBytes(UTF_8));
-                } catch (IOException e) {
-                    throw new RuntimeException("error emitting HTML", e);
-                }
+        AnsiHtmlOutputStream ansi = new AnsiHtmlOutputStream(bos, colorMap, html -> {
+            try {
+                bos.write(html.getBytes(UTF_8));
+            } catch (IOException e) {
+                throw new RuntimeException("error emitting HTML", e);
             }
         });
         ansi.write(text.getBytes(UTF_8));
diff --git a/src/test/java/hudson/plugins/ansicolor/ColorConsoleAnnotatorTest.java b/src/test/java/hudson/plugins/ansicolor/ColorConsoleAnnotatorTest.java
index f9eede1..2d87b87 100644
--- a/src/test/java/hudson/plugins/ansicolor/ColorConsoleAnnotatorTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/ColorConsoleAnnotatorTest.java
@@ -3,60 +3,45 @@ package hudson.plugins.ansicolor;
 import jenkins.model.Jenkins;
 import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
 import org.jenkinsci.plugins.workflow.job.WorkflowJob;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.jvnet.hudson.test.BuildWatcher;
-import org.jvnet.hudson.test.LoggerRule;
-import org.jvnet.hudson.test.RestartableJenkinsRule;
+import org.junit.jupiter.api.Test;
+import org.jvnet.hudson.test.JenkinsRule;
+import org.jvnet.hudson.test.junit.jupiter.WithJenkins;
 
 import java.io.StringWriter;
-import java.util.logging.Level;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-public class ColorConsoleAnnotatorTest {
-    @ClassRule
-    public static BuildWatcher buildWatcher = new BuildWatcher();
-
-    @Rule
-    public RestartableJenkinsRule jenkinsRule = new RestartableJenkinsRule();
-
-    @Rule
-    public LoggerRule logging = new LoggerRule().record(ColorConsoleAnnotator.class, Level.FINER);
+@WithJenkins
+class ColorConsoleAnnotatorTest {
 
     @Test
-    public void testGlobalPipelineColorMap() {
-        jenkinsRule.then(r -> {
-            Jenkins.get().getDescriptorByType(AnsiColorBuildWrapper.DescriptorImpl.class).setGlobalColorMapName("xterm");
-            WorkflowJob p = jenkinsRule.j.jenkins.createProject(WorkflowJob.class, "p");
-            p.setDefinition(new CpsFlowDefinition("echo 'The following word is supposed to be \\u001B[31mred\\u001B[0m'", true));
-            jenkinsRule.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
-            StringWriter writer = new StringWriter();
-            assertTrue(p.getLastBuild().getLogText().writeHtmlTo(0L, writer) > 0);
-            String html = writer.toString();
-            assertTrue(
-                "Failed to match color attribute in following HTML log output:\n" + html,
-                html.replaceAll("<!--.+?-->", "").matches("(?s).*<span style=\"color: #CD0000;\">red</span>.*")
-            );
-        });
+    void testGlobalPipelineColorMap(JenkinsRule jenkinsRule) throws Exception {
+        Jenkins.get().getDescriptorByType(AnsiColorBuildWrapper.DescriptorImpl.class).setGlobalColorMapName("xterm");
+        WorkflowJob p = jenkinsRule.jenkins.createProject(WorkflowJob.class, "p");
+        p.setDefinition(new CpsFlowDefinition("echo 'The following word is supposed to be \\u001B[31mred\\u001B[0m'", true));
+        jenkinsRule.assertBuildStatusSuccess(p.scheduleBuild2(0));
+        StringWriter writer = new StringWriter();
+        assertTrue(p.getLastBuild().getLogText().writeHtmlTo(0L, writer) > 0);
+        String html = writer.toString();
+        assertTrue(
+            html.replaceAll("<!--.+?-->", "").matches("(?s).*<span style=\"color: #CD0000;\">red</span>.*"),
+            "Failed to match color attribute in following HTML log output:\n" + html
+        );
     }
 
     @Test
-    public void testNoGlobalPipelineColorMap() {
-        jenkinsRule.then(r -> {
-            Jenkins.get().getDescriptorByType(AnsiColorBuildWrapper.DescriptorImpl.class).setGlobalColorMapName(null);
-            WorkflowJob p = jenkinsRule.j.jenkins.createProject(WorkflowJob.class, "p");
-            p.setDefinition(new CpsFlowDefinition("echo 'The following word is supposed to be \\u001B[31mred\\u001B[0m'", true));
-            jenkinsRule.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
-            StringWriter writer = new StringWriter();
-            assertTrue(p.getLastBuild().getLogText().writeHtmlTo(0L, writer) > 0);
-            String html = writer.toString();
-            assertFalse(
-                "Color attribute was applied in following HTML log output even though the color map was not globally enabled:\n" + html,
-                html.replaceAll("<!--.+?-->", "").matches("(?s).*<span style=\"color: #CD0000;\">red</span>.*")
-            );
-        });
+    void testNoGlobalPipelineColorMap(JenkinsRule jenkinsRule) throws Exception {
+        Jenkins.get().getDescriptorByType(AnsiColorBuildWrapper.DescriptorImpl.class).setGlobalColorMapName(null);
+        WorkflowJob p = jenkinsRule.jenkins.createProject(WorkflowJob.class, "p");
+        p.setDefinition(new CpsFlowDefinition("echo 'The following word is supposed to be \\u001B[31mred\\u001B[0m'", true));
+        jenkinsRule.assertBuildStatusSuccess(p.scheduleBuild2(0));
+        StringWriter writer = new StringWriter();
+        assertTrue(p.getLastBuild().getLogText().writeHtmlTo(0L, writer) > 0);
+        String html = writer.toString();
+        assertFalse(
+            html.replaceAll("<!--.+?-->", "").matches("(?s).*<span style=\"color: #CD0000;\">red</span>.*"),
+            "Color attribute was applied in following HTML log output even though the color map was not globally enabled:\n" + html
+        );
     }
 }
diff --git a/src/test/java/hudson/plugins/ansicolor/JenkinsTestSupport.java b/src/test/java/hudson/plugins/ansicolor/JenkinsTestSupport.java
index c11d2a2..89716b1 100644
--- a/src/test/java/hudson/plugins/ansicolor/JenkinsTestSupport.java
+++ b/src/test/java/hudson/plugins/ansicolor/JenkinsTestSupport.java
@@ -3,9 +3,8 @@ package hudson.plugins.ansicolor;
 import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
 import org.jenkinsci.plugins.workflow.job.WorkflowJob;
 import org.jenkinsci.plugins.workflow.job.WorkflowRun;
-import org.junit.Assume;
-import org.junit.Rule;
-import org.jvnet.hudson.test.RestartableJenkinsRule;
+import org.jvnet.hudson.test.JenkinsRule;
+import org.jvnet.hudson.test.junit.jupiter.WithJenkins;
 
 import java.io.File;
 import java.io.StringWriter;
@@ -19,60 +18,59 @@ import java.util.stream.IntStream;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
+@WithJenkins
 public class JenkinsTestSupport {
     private static final int CONSOLE_TAIL_DEFAULT = 150;
 
-    @Rule
-    public RestartableJenkinsRule jenkinsRule = new RestartableJenkinsRule();
-
     protected void assertOutputOnRunningPipeline(
+        JenkinsRule jenkinsRule,
         BooleanSupplier assumption,
         String expectedOutput,
         String notExpectedOutput,
         String pipelineScript,
         boolean useShortLog,
         Map<String, String> properties
-    ) {
-        assertOutputOnRunningPipeline(assumption, Collections.singletonList(expectedOutput), Collections.singletonList(notExpectedOutput), pipelineScript, useShortLog, properties);
+    ) throws Exception {
+        assertOutputOnRunningPipeline(jenkinsRule, assumption, Collections.singletonList(expectedOutput), Collections.singletonList(notExpectedOutput), pipelineScript, useShortLog, properties);
     }
 
-    protected void assertOutputOnRunningPipeline(Collection<String> expectedOutput, Collection<String> notExpectedOutput, String pipelineScript, boolean useShortLog) {
-        assertOutputOnRunningPipeline(() -> true, expectedOutput, notExpectedOutput, pipelineScript, useShortLog, Collections.emptyMap());
+    protected void assertOutputOnRunningPipeline(JenkinsRule jenkinsRule, Collection<String> expectedOutput, Collection<String> notExpectedOutput, String pipelineScript, boolean useShortLog) throws Exception {
+        assertOutputOnRunningPipeline(jenkinsRule, () -> true, expectedOutput, notExpectedOutput, pipelineScript, useShortLog, Collections.emptyMap());
     }
 
-    protected void assertOutputOnRunningPipeline(Collection<String> expectedOutput, Collection<String> notExpectedOutput, String pipelineScript, boolean useShortLog, Map<String, String> properties) {
-        assertOutputOnRunningPipeline(() -> true, expectedOutput, notExpectedOutput, pipelineScript, useShortLog, properties);
+    protected void assertOutputOnRunningPipeline(JenkinsRule jenkinsRule, Collection<String> expectedOutput, Collection<String> notExpectedOutput, String pipelineScript, boolean useShortLog, Map<String, String> properties) throws Exception {
+        assertOutputOnRunningPipeline(jenkinsRule, () -> true, expectedOutput, notExpectedOutput, pipelineScript, useShortLog, properties);
     }
 
     protected void assertOutputOnRunningPipeline(
+        JenkinsRule jenkinsRule,
         BooleanSupplier assumption,
         Collection<String> expectedOutput,
         Collection<String> notExpectedOutput,
         String pipelineScript,
         boolean useShortLog,
         Map<String, String> properties
-    ) {
-        jenkinsRule.then(r -> {
-            Assume.assumeTrue(assumption.getAsBoolean());
-            properties.forEach(System::setProperty);
-            final WorkflowJob project = jenkinsRule.j.jenkins.createProject(WorkflowJob.class, "test-project-" + JenkinsTestSupport.this.getClass().getSimpleName());
-            project.setDefinition(new CpsFlowDefinition(pipelineScript, true));
-            jenkinsRule.j.assertBuildStatusSuccess(project.scheduleBuild2(0));
-            StringWriter writer = new StringWriter();
-            final WorkflowRun lastBuild = project.getLastBuild();
-            final long start = useShortLog ? new File(lastBuild.getRootDir(), "log").length() - CONSOLE_TAIL_DEFAULT * 1024 : 0;
-            assertTrue(lastBuild.getLogText().writeHtmlTo(start, writer) > 0);
-            properties.keySet().forEach(System::clearProperty);
-            final String html = writer.toString().replaceAll("<!--.+?-->", "");
-            for (String expected : expectedOutput) {
-                assertThat(html, containsString(expected));
-            }
-            for (String notExpected : notExpectedOutput) {
-                assertThat(html, not(containsString(notExpected)));
-            }
-        });
+    ) throws Exception {
+        assumeTrue(assumption.getAsBoolean());
+        properties.forEach(System::setProperty);
+        final WorkflowJob project = jenkinsRule.jenkins.createProject(WorkflowJob.class, "test-project-" + JenkinsTestSupport.this.getClass().getSimpleName());
+        project.setDefinition(new CpsFlowDefinition(pipelineScript, true));
+        jenkinsRule.assertBuildStatusSuccess(project.scheduleBuild2(0));
+        StringWriter writer = new StringWriter();
+        final WorkflowRun lastBuild = project.getLastBuild();
+        final long start = useShortLog ? new File(lastBuild.getRootDir(), "log").length() - CONSOLE_TAIL_DEFAULT * 1024 : 0;
+        assertTrue(lastBuild.getLogText().writeHtmlTo(start, writer) > 0);
+        properties.keySet().forEach(System::clearProperty);
+        final String html = writer.toString().replaceAll("<!--.+?-->", "");
+        for (String expected : expectedOutput) {
+            assertThat(html, containsString(expected));
+        }
+        for (String notExpected : notExpectedOutput) {
+            assertThat(html, not(containsString(notExpected)));
+        }
     }
 
     public static String repeat(String s, int times) {
diff --git a/src/test/java/hudson/plugins/ansicolor/TimestamperIntegrationTest.java b/src/test/java/hudson/plugins/ansicolor/TimestamperIntegrationTest.java
index 4620683..f19527f 100644
--- a/src/test/java/hudson/plugins/ansicolor/TimestamperIntegrationTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/TimestamperIntegrationTest.java
@@ -1,34 +1,38 @@
 package hudson.plugins.ansicolor;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.jvnet.hudson.test.JenkinsRule;
+import org.jvnet.hudson.test.junit.jupiter.WithJenkins;
 
 import java.util.Arrays;
 
-public class TimestamperIntegrationTest extends JenkinsTestSupport {
+@WithJenkins
+class TimestamperIntegrationTest extends JenkinsTestSupport {
 
     @Test
-    public void canTriggerFunctionalityTimestamperFirst() {
+    void canTriggerFunctionalityTimestamperFirst(JenkinsRule jenkinsRule) throws Exception {
         final String script = "timestamps {" +
             "ansiColor('xterm') {" +
             "echo '\033[34mHello\033[0m \033[33mcolorful\033[0m \033[35mworld!\033[0m'" +
             "}" +
             "}";
-        canTriggerFunctionality(script);
+        canTriggerFunctionality(jenkinsRule, script);
     }
 
 
     @Test
-    public void canTriggerFunctionalityTimestamperLast() {
+    void canTriggerFunctionalityTimestamperLast(JenkinsRule jenkinsRule) throws Exception {
         final String script = "ansiColor('xterm') {" +
             "timestamps {" +
             "echo '\033[34mHello\033[0m \033[33mcolorful\033[0m \033[35mworld!\033[0m'" +
             "}" +
             "}";
-        canTriggerFunctionality(script);
+        canTriggerFunctionality(jenkinsRule, script);
     }
 
-    private void canTriggerFunctionality(String script) {
+    private void canTriggerFunctionality(JenkinsRule jenkinsRule, String script) throws Exception {
         assertOutputOnRunningPipeline(
+            jenkinsRule,
             Arrays.asList(
                 "<span style=\"color: #1E90FF;\">Hello</span>",
                 "<span style=\"color: #CDCD00;\">colorful</span>",
diff --git a/src/test/java/hudson/plugins/ansicolor/action/ActionNoteTest.java b/src/test/java/hudson/plugins/ansicolor/action/ActionNoteTest.java
index 8328e54..0568b97 100644
--- a/src/test/java/hudson/plugins/ansicolor/action/ActionNoteTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/action/ActionNoteTest.java
@@ -2,22 +2,22 @@ package hudson.plugins.ansicolor.action;
 
 import hudson.MarkupText;
 import hudson.model.FreeStyleBuild;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
 
 import java.util.UUID;
 
 import static hudson.plugins.ansicolor.action.ActionNote.TAG_ACTION_BEGIN;
 import static hudson.plugins.ansicolor.action.ActionNote.TAG_ACTION_END;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.when;
 
-@RunWith(MockitoJUnitRunner.class)
-public class ActionNoteTest {
+@ExtendWith(MockitoExtension.class)
+class ActionNoteTest {
     private static final UUID UUID = java.util.UUID.randomUUID();
 
     private ActionNote actionNote;
@@ -28,14 +28,14 @@ public class ActionNoteTest {
     @Mock
     private FreeStyleBuild buildRun;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         when(colorizedAction.getId()).thenReturn(UUID.toString());
         actionNote = new ActionNote(colorizedAction);
     }
 
     @Test
-    public void canAnnotate() {
+    void canAnnotate() {
         final MarkupText markupText = new MarkupText("abc123");
         assertNull(actionNote.annotate(buildRun, markupText, 4));
         final String output = markupText.toString(false);
diff --git a/src/test/java/hudson/plugins/ansicolor/action/ColorizedActionTest.java b/src/test/java/hudson/plugins/ansicolor/action/ColorizedActionTest.java
index 817c124..bd12e5e 100644
--- a/src/test/java/hudson/plugins/ansicolor/action/ColorizedActionTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/action/ColorizedActionTest.java
@@ -2,24 +2,24 @@ package hudson.plugins.ansicolor.action;
 
 import hudson.MarkupText;
 import hudson.model.FreeStyleBuild;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
 
 import java.util.Arrays;
 
 import static hudson.plugins.ansicolor.action.ActionNote.TAG_ACTION_BEGIN;
 import static hudson.plugins.ansicolor.action.ActionNote.TAG_ACTION_END;
 import static hudson.plugins.ansicolor.action.ColorizedAction.CONTINUE;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.when;
 
-@RunWith(MockitoJUnitRunner.class)
-public class ColorizedActionTest {
+@ExtendWith(MockitoExtension.class)
+class ColorizedActionTest {
     private static final ColorizedAction ACTION_0 = new ColorizedAction("map0", ColorizedAction.Command.START);
     private static final ColorizedAction ACTION_1 = new ColorizedAction("map0", ColorizedAction.Command.CONTINUE);
     private static final ColorizedAction ACTION_2 = new ColorizedAction("map0", ColorizedAction.Command.STOP);
@@ -29,17 +29,17 @@ public class ColorizedActionTest {
 
     private ColorizedAction colorizedAction;
 
-    @Mock
+    @Mock(strictness = Mock.Strictness.LENIENT)
     private FreeStyleBuild buildRunSingleStart;
 
-    @Mock
+    @Mock(strictness = Mock.Strictness.LENIENT)
     private FreeStyleBuild buildRunMultipleStarts;
 
-    @Mock
+    @Mock(strictness = Mock.Strictness.LENIENT)
     private FreeStyleBuild buildRunOneCurrent;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         when(buildRunSingleStart.getActions(eq(ColorizedAction.class))).thenReturn(Arrays.asList(
             ACTION_0,
             ACTION_1,
@@ -61,34 +61,34 @@ public class ColorizedActionTest {
     }
 
     @Test
-    public void canInitAndGetProperties() {
+    void canInitAndGetProperties() {
         assertNotNull(colorizedAction.getId());
         assertEquals("vga", colorizedAction.getColorMapName());
         assertEquals(ColorizedAction.Command.START, colorizedAction.getCommand());
     }
 
     @Test
-    public void canParseActionSingleStart() {
+    void canParseActionSingleStart() {
         final MarkupText markupText = new MarkupText("Log line");
         markupText.addMarkup(0, TAG_ACTION_BEGIN + "\"" + ACTION_1.getId() + "\"" + TAG_ACTION_END);
         assertEquals(ACTION_1, ColorizedAction.parseAction(markupText, buildRunSingleStart));
     }
 
     @Test
-    public void willNotTriggerStartIfThereIsExactlyOneStartActionAndNoCorrespondingAnnotation() {
+    void willNotTriggerStartIfThereIsExactlyOneStartActionAndNoCorrespondingAnnotation() {
         final MarkupText markupText = new MarkupText("Log line");
         assertEquals(CONTINUE, ColorizedAction.parseAction(markupText, buildRunSingleStart));
     }
 
     @Test
-    public void willReturnDefaultIfLogAnnotationPointsToNonexistentActionSingleStart() {
+    void willReturnDefaultIfLogAnnotationPointsToNonexistentActionSingleStart() {
         final MarkupText markupText = new MarkupText("Log line");
         markupText.addMarkup(0, TAG_ACTION_BEGIN + "\"identifier_not_in_actions\"" + TAG_ACTION_END);
         assertEquals(CONTINUE, ColorizedAction.parseAction(markupText, buildRunSingleStart));
     }
 
     @Test
-    public void willReturnCommandIgnoreOnPipelineInternalLineSingleStart() {
+    void willReturnCommandIgnoreOnPipelineInternalLineSingleStart() {
         final MarkupText markupText = new MarkupText("Some internal line");
         markupText.addMarkup(0, "<span class=\"pipeline-new-node\">");
         final ColorizedAction colorizedAction = ColorizedAction.parseAction(markupText, buildRunSingleStart);
@@ -96,27 +96,27 @@ public class ColorizedActionTest {
     }
 
     @Test
-    public void canParseActionMultipleStarts() {
+    void canParseActionMultipleStarts() {
         final MarkupText markupText = new MarkupText("Log line");
         markupText.addMarkup(0, TAG_ACTION_BEGIN + "\"" + ACTION_3.getId() + "\"" + TAG_ACTION_END);
         assertEquals(ACTION_3, ColorizedAction.parseAction(markupText, buildRunMultipleStarts));
     }
 
     @Test
-    public void willReturnDefaultIfLogDoesntContainAnnotation() {
+    void willReturnDefaultIfLogDoesntContainAnnotation() {
         final MarkupText markupText = new MarkupText("Log line");
         assertEquals(CONTINUE, ColorizedAction.parseAction(markupText, buildRunMultipleStarts));
     }
 
     @Test
-    public void willReturnDefaultIfLogAnnotationPointsToNonexistentActionMultipleStarts() {
+    void willReturnDefaultIfLogAnnotationPointsToNonexistentActionMultipleStarts() {
         final MarkupText markupText = new MarkupText("Log line");
         markupText.addMarkup(0, TAG_ACTION_BEGIN + "\"identifier_not_in_actions\"" + TAG_ACTION_END);
         assertEquals(CONTINUE, ColorizedAction.parseAction(markupText, buildRunMultipleStarts));
     }
 
     @Test
-    public void willReturnCommandIgnoreOnPipelineInternalLineMultipleStarts() {
+    void willReturnCommandIgnoreOnPipelineInternalLineMultipleStarts() {
         final MarkupText markupText = new MarkupText("Some internal line");
         markupText.addMarkup(0, "<span class=\"pipeline-new-node\">");
         final ColorizedAction colorizedAction = ColorizedAction.parseAction(markupText, buildRunMultipleStarts);
@@ -124,21 +124,21 @@ public class ColorizedActionTest {
     }
 
     @Test
-    public void canParseActionCurrentWhileBuildRunning() {
+    void canParseActionCurrentWhileBuildRunning() {
         when(buildRunOneCurrent.isBuilding()).thenReturn(true);
         final MarkupText markupText = new MarkupText("Log line");
         assertEquals(ACTION_5, ColorizedAction.parseAction(markupText, buildRunOneCurrent));
     }
 
     @Test
-    public void wontParseActionCurrentWhileBuildNotRunning() {
+    void wontParseActionCurrentWhileBuildNotRunning() {
         when(buildRunOneCurrent.isBuilding()).thenReturn(false);
         final MarkupText markupText = new MarkupText("Log line");
         assertEquals(CONTINUE, ColorizedAction.parseAction(markupText, buildRunOneCurrent));
     }
 
     @Test
-    public void wontParseActionCurrentWhileBuildRunningButNoCurrentAction() {
+    void wontParseActionCurrentWhileBuildRunningButNoCurrentAction() {
         when(buildRunSingleStart.isBuilding()).thenReturn(true);
         final MarkupText markupText = new MarkupText("Log line");
         assertEquals(CONTINUE, ColorizedAction.parseAction(markupText, buildRunSingleStart));
diff --git a/src/test/java/hudson/plugins/ansicolor/action/LineIdentifierTest.java b/src/test/java/hudson/plugins/ansicolor/action/LineIdentifierTest.java
index 3e439a7..2e641f1 100644
--- a/src/test/java/hudson/plugins/ansicolor/action/LineIdentifierTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/action/LineIdentifierTest.java
@@ -1,31 +1,33 @@
 package hudson.plugins.ansicolor.action;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-public class LineIdentifierTest {
+class LineIdentifierTest {
 
     private LineIdentifier lineIdentifier;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         lineIdentifier = new LineIdentifier();
     }
 
     @Test
-    public void canHashLine() {
+    void canHashLine() {
         assertEquals("ojq32twB56Mha38FSpsOvwxZDdkOKa/SveGHDC4tgHY=", lineIdentifier.hash("test line 123", 735));
     }
 
     @Test
-    public void canDetermineIsEqualPositive() {
+    void canDetermineIsEqualPositive() {
         assertTrue(lineIdentifier.isEqual("\u001B[92m\u001B[1mlightgreen bold \u001B[92m\u001B[22mlightgreen normal\u001B[0m", 67, "1mo5/lFK3s3+qaz1vK3o62k+EAJkd8Q0j3dMRH8Wkh4="));
     }
 
     @Test
-    public void canDetermineIsEqualNegative() {
+    void canDetermineIsEqualNegative() {
         assertFalse(lineIdentifier.isEqual("\u001B[92m\u001B[1mlightgreen bold \u001B[92m\u001B[22mlightgreen normal\u001B[0m", 67, "bogus"));
     }
 }
diff --git a/src/test/java/hudson/plugins/ansicolor/action/ShortlogActionCreatorIntegrationTest.java b/src/test/java/hudson/plugins/ansicolor/action/ShortlogActionCreatorIntegrationTest.java
index f28582d..ae73d44 100644
--- a/src/test/java/hudson/plugins/ansicolor/action/ShortlogActionCreatorIntegrationTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/action/ShortlogActionCreatorIntegrationTest.java
@@ -2,8 +2,10 @@ package hudson.plugins.ansicolor.action;
 
 import hudson.plugins.ansicolor.JenkinsTestSupport;
 import jenkins.model.Jenkins;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.jvnet.hudson.test.JenkinsRule;
+import org.jvnet.hudson.test.junit.jupiter.WithJenkins;
 
 import java.util.Arrays;
 import java.util.HashMap;
@@ -11,14 +13,15 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.function.BooleanSupplier;
 
-public class ShortlogActionCreatorIntegrationTest extends JenkinsTestSupport {
+@WithJenkins
+class ShortlogActionCreatorIntegrationTest extends JenkinsTestSupport {
     private static final String AS_1K = repeat("a", 1024);
     private static final String BS_1K = repeat("b", 1024);
     private static final String CS_1K = repeat("c", 1024);
     private static final String DS_1K = repeat("d", 1024);
 
     @Test
-    public void canAnnotateLongLogOutputInShortlogLinesWholeFalse() {
+    void canAnnotateLongLogOutputInShortlogLinesWholeFalse(JenkinsRule jenkinsRule) throws Exception {
         final String script = "ansiColor('xterm') {\n" +
             repeat("echo '\033[32m" + AS_1K + "\033[0m'\n", 150) +
             "}";
@@ -27,12 +30,12 @@ public class ShortlogActionCreatorIntegrationTest extends JenkinsTestSupport {
         BooleanSupplier brokenLinesJenkins = () -> Optional.ofNullable(Jenkins.getVersion())
             .orElse(ShortlogActionCreator.LINES_WHOLE_SINCE_VERSION)
             .isOlderThan(ShortlogActionCreator.LINES_WHOLE_SINCE_VERSION);
-        assertOutputOnRunningPipeline(brokenLinesJenkins, "<span style=\"color: #00CD00;\">" + AS_1K + "</span>", "\033", script, true, properties);
+        assertOutputOnRunningPipeline(jenkinsRule, brokenLinesJenkins, "<span style=\"color: #00CD00;\">" + AS_1K + "</span>", "\033", script, true, properties);
     }
 
     @Test
-    @Ignore("Needs adjustments for Jenkins > 2.260")
-    public void canAnnotateLongLogOutputInShortlogLinesWholeTrue() {
+    @Disabled("Needs adjustments for Jenkins > 2.260")
+    void canAnnotateLongLogOutputInShortlogLinesWholeTrue(JenkinsRule jenkinsRule) throws Exception {
         final String script = "ansiColor('xterm') {\n" +
             repeat("echo '\033[32m" + AS_1K + "\033[0m'\n", 150) +
             "echo 'Abc'\n" +
@@ -42,11 +45,11 @@ public class ShortlogActionCreatorIntegrationTest extends JenkinsTestSupport {
         BooleanSupplier wholeLinesJenkins = () -> Optional.ofNullable(Jenkins.getVersion())
             .orElse(ShortlogActionCreator.LINES_WHOLE_SINCE_VERSION)
             .isNewerThan(ShortlogActionCreator.LINES_WHOLE_SINCE_VERSION);
-        assertOutputOnRunningPipeline(wholeLinesJenkins, "<span style=\"color: #00CD00;\">" + AS_1K + "</span>", "\033", script, true, properties);
+        assertOutputOnRunningPipeline(jenkinsRule, wholeLinesJenkins, "<span style=\"color: #00CD00;\">" + AS_1K + "</span>", "\033", script, true, properties);
     }
 
     @Test
-    public void canAnnotateLongLogOutputInShortlogMultipleStepsLinesWholeFalse() {
+    void canAnnotateLongLogOutputInShortlogMultipleStepsLinesWholeFalse(JenkinsRule jenkinsRule) throws Exception {
         final String script = "echo '\033[32mBeginning\033[0m'\n" +
             "ansiColor('vga') {\n" +
             repeat("    echo '\033[32m" + AS_1K + "\033[0m'\n", 11) +
@@ -63,6 +66,7 @@ public class ShortlogActionCreatorIntegrationTest extends JenkinsTestSupport {
         final Map<String, String> properties = new HashMap<>();
         properties.put(ShortlogActionCreator.PROP_LINES_WHOLE, "false");
         assertOutputOnRunningPipeline(
+            jenkinsRule,
             Arrays.asList(
                 "<span style=\"color: #00CD00;\">" + BS_1K + "</span>",
                 "<span style=\"color: green;\">" + CS_1K + "</span>",
@@ -84,7 +88,7 @@ public class ShortlogActionCreatorIntegrationTest extends JenkinsTestSupport {
     }
 
     @Test
-    public void canAnnotateLongLogOutputInShortlogMultipleStepsLinesWholeTrue() {
+    void canAnnotateLongLogOutputInShortlogMultipleStepsLinesWholeTrue(JenkinsRule jenkinsRule) throws Exception {
         final String script = "echo '\033[32mBeginning\033[0m'\n" +
             "ansiColor('vga') {\n" +
             repeat("    echo '\033[32m" + AS_1K + "\033[0m'\n", 10) +
@@ -101,6 +105,7 @@ public class ShortlogActionCreatorIntegrationTest extends JenkinsTestSupport {
         final Map<String, String> properties = new HashMap<>();
         properties.put(ShortlogActionCreator.PROP_LINES_WHOLE, "true");
         assertOutputOnRunningPipeline(
+            jenkinsRule,
             Arrays.asList(
                 "\033[32m" + BS_1K + "\033[0m",
                 "<span style=\"color: green;\">" + CS_1K + "</span>",
diff --git a/src/test/java/hudson/plugins/ansicolor/action/ShortlogActionCreatorTest.java b/src/test/java/hudson/plugins/ansicolor/action/ShortlogActionCreatorTest.java
index 3bee8d6..a5e6fa4 100644
--- a/src/test/java/hudson/plugins/ansicolor/action/ShortlogActionCreatorTest.java
+++ b/src/test/java/hudson/plugins/ansicolor/action/ShortlogActionCreatorTest.java
@@ -1,36 +1,42 @@
 package hudson.plugins.ansicolor.action;
 
-import hudson.console.ConsoleNote;
 import hudson.Functions;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import hudson.console.ConsoleNote;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
 
 import java.io.File;
 import java.net.URL;
 import java.util.HashMap;
 
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.*;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ShortlogActionCreatorTest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+import static org.mockito.Mockito.anyLong;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@ExtendWith(MockitoExtension.class)
+class ShortlogActionCreatorTest {
     private ShortlogActionCreator shortlogActionCreator;
 
-    @Mock
+    @Mock(strictness = Mock.Strictness.LENIENT)
     private LineIdentifier lineIdentifier;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         shortlogActionCreator = new ShortlogActionCreator(lineIdentifier, "\n");
     }
 
     @Test
-    public void canCreateActionForShortlog() {
+    void canCreateActionForShortlog() {
         final String shortlogLine = "\u001B[3B\u001B[2A\u001B[2K \u001B[92m\u001B[1mlightgreen bold \u001B[92m\u001B[22mlightgreen normal\u001B[0m \u001B[92m\u001B[1mlightgreen bold " +
             "\u001B[92m\u001B[22mlightgreen normal\u001B[0m \u001B[92m\u001B[1mlightgreen bold \u001B[92m\u001B[22mlightgreen normal\u001B[0m \u001B[92m\u001B[1mlightgreen bold " +
             "\u001B[92m\u001B[22mlightgreen normal\u001B[0m \u001B[92m\u001B[1mlightgreen bold \u001B[92m\u001B[22mlightgreen normal\u001B[0m \u001B[92m\u001B[1mlightgreen bold " +
@@ -41,12 +47,12 @@ public class ShortlogActionCreatorTest {
     }
 
     @Test
-    public void canCreateActionForShortlogBreakLines() {
+    void canCreateActionForShortlogBreakLines() {
         canCreateActionForShortlog(shortlogActionCreator, "[Pipeline] echo\n", "testlog.log", false);
     }
 
     @Test
-    public void canCreateActionForShortlogForWindows() {
+    void canCreateActionForShortlogForWindows() {
         final String shortlogLine = "\u001B[3B\u001B[2A\u001B[2K \u001B[92m\u001B[1mlightgreen bold \u001B[92m\u001B[22mlightgreen normal\u001B[0m \u001B[92m\u001B[1mlightgreen bold " +
             "\u001B[92m\u001B[22mlightgreen normal\u001B[0m \u001B[92m\u001B[1mlightgreen bold \u001B[92m\u001B[22mlightgreen normal\u001B[0m \u001B[92m\u001B[1mlightgreen bold " +
             "\u001B[92m\u001B[22mlightgreen normal\u001B[0m \u001B[92m\u001B[1mlightgreen bold \u001B[92m\u001B[22mlightgreen normal\u001B[0m \u001B[92m\u001B[1mlightgreen bold " +
@@ -58,7 +64,7 @@ public class ShortlogActionCreatorTest {
     }
 
     @Test
-    public void canCreateActionForShortlogForWindowsBreakLines() {
+    void canCreateActionForShortlogForWindowsBreakLines() {
         final String eol = "\r\n";
         canCreateActionForShortlog(new ShortlogActionCreator(lineIdentifier, eol), "[Pipeline] echo" + eol, "testlog-crlf.log", false);
     }
@@ -70,7 +76,7 @@ public class ShortlogActionCreatorTest {
         when(lineIdentifier.hash(eq(shortlogLine), eq(1L))).thenReturn(lineHash);
 
         final URL inputFile = getClass().getResource(String.join("/", "", getClass().getName().replace('.', '/'), logFile));
-        Assume.assumeNotNull(inputFile);
+        assumeTrue(inputFile != null);
         final File file = new File(inputFile.getFile());
         final HashMap<String, ColorizedAction> startActions = new HashMap<>();
         startActions.put(ConsoleNote.PREAMBLE_STR + "<mock-serialized-note-start0>", new ColorizedAction("css", ColorizedAction.Command.START));
@@ -89,13 +95,13 @@ public class ShortlogActionCreatorTest {
     }
 
     @Test
-    public void wontCreateActionForLogFileShorterThanShortlogLimit() {
+    void wontCreateActionForLogFileShorterThanShortlogLimit() {
         final boolean[] keepLinesWholeOptions = {true, false};
         for (boolean keepLinesWhole : keepLinesWholeOptions) {
             final String serializedNote = "<mock-serialized-note-start>";
             final ColorizedAction colorizedAction = new ColorizedAction("xterm", ColorizedAction.Command.START);
             final URL inputFile = getClass().getResource(String.join("/", "", getClass().getName().replace('.', '/'), "testlog.log"));
-            Assume.assumeNotNull(inputFile);
+            assumeTrue(inputFile != null);
             final File file = new File(inputFile.getFile());
             final HashMap<String, ColorizedAction> startActions = new HashMap<>();
             startActions.put(ConsoleNote.PREAMBLE_STR + "<mock-serialized-note-start0>", new ColorizedAction("css", ColorizedAction.Command.START));
@@ -106,11 +112,11 @@ public class ShortlogActionCreatorTest {
     }
 
     @Test
-    public void wontCreateActionIfBuildHasNoStartActions() {
+    void wontCreateActionIfBuildHasNoStartActions() {
         final boolean[] keepLinesWholeOptions = {true, false};
         for (boolean keepLinesWhole : keepLinesWholeOptions) {
             final URL inputFile = getClass().getResource(String.join("/", "", getClass().getName().replace('.', '/'), "testlog.log"));
-            Assume.assumeNotNull(inputFile);
+            assumeTrue(inputFile != null);
             final File file = new File(inputFile.getFile());
             assertNull(shortlogActionCreator.createActionForShortlog(file, new HashMap<>(), 3, keepLinesWhole, 0));
             verify(lineIdentifier, never()).hash(anyString(), anyLong());
@@ -118,14 +124,14 @@ public class ShortlogActionCreatorTest {
     }
 
     @Test
-    public void wontCreateActionIfNoCorrespondingNotesArePresent() {
+    void wontCreateActionIfNoCorrespondingNotesArePresent() {
         final boolean[] keepLinesWholeOptions = {true, false};
         for (boolean keepLinesWhole : keepLinesWholeOptions) {
             final HashMap<String, ColorizedAction> startActions = new HashMap<>();
             startActions.put(ConsoleNote.PREAMBLE_STR + "<mock-serialized-note-start0>", new ColorizedAction("css", ColorizedAction.Command.START));
             startActions.put(ConsoleNote.PREAMBLE_STR + "<mock-serialized-note-stop0>", new ColorizedAction("css", ColorizedAction.Command.STOP));
             final URL inputFile = getClass().getResource(String.join("/", "", getClass().getName().replace('.', '/'), "testlog-no-notes.log"));
-            Assume.assumeNotNull(inputFile);
+            assumeTrue(inputFile != null);
             final File file = new File(inputFile.getFile());
             assertNull(shortlogActionCreator.createActionForShortlog(file, startActions, 3, keepLinesWhole, 0));
             verify(lineIdentifier, never()).hash(anyString(), anyLong());
@@ -133,7 +139,7 @@ public class ShortlogActionCreatorTest {
     }
 
     @Test
-    public void wontCreateActionIfNoLogFileIsPresent() {
+    void wontCreateActionIfNoLogFileIsPresent() {
         final boolean[] keepLinesWholeOptions = {true, false};
         for (boolean keepLinesWhole : keepLinesWholeOptions) {
             final HashMap<String, ColorizedAction> startActions = new HashMap<>();
@@ -145,11 +151,11 @@ public class ShortlogActionCreatorTest {
     }
 
     @Test
-    public void wontCreateActionIfActionIsNotActiveAtShortlogLimit() {
+    void wontCreateActionIfActionIsNotActiveAtShortlogLimit() {
         final boolean[] keepLinesWholeOptions = {true, false};
         for (boolean keepLinesWhole : keepLinesWholeOptions) {
             final URL inputFile = getClass().getResource(String.join("/", "", getClass().getName().replace('.', '/'), "testlog-action-not-active.log"));
-            Assume.assumeNotNull(inputFile);
+            assumeTrue(inputFile != null);
             final File file = new File(inputFile.getFile());
             final HashMap<String, ColorizedAction> startActions = new HashMap<>();
             startActions.put(ConsoleNote.PREAMBLE_STR + "<mock-serialized-note-start>", new ColorizedAction("css", ColorizedAction.Command.START));
@@ -161,13 +167,13 @@ public class ShortlogActionCreatorTest {
     }
 
     @Test
-    public void canCreateActionForShortlogOnLogLineExceedingBufferSize() {
+    void canCreateActionForShortlogOnLogLineExceedingBufferSize() {
         final String s = "[Pipeline]  echo a very very very long line,a very very very long line,a very very very long line,a very very very long line,a very very very long line";
         canCreateActionForShortlog(shortlogActionCreator, s + "\n", "testlog-long.log", true);
     }
 
     @Test
-    public void canCreateActionForShortlogOnLogLineExceedingBufferSizeBreakLines() {
+    void canCreateActionForShortlogOnLogLineExceedingBufferSizeBreakLines() {
         final String s = "[Pipeline]  echo a very very very long line,a very very very long line,a very very very long line,a very very very long line,a very very very long line";
         canCreateActionForShortlog(shortlogActionCreator, s + "\n", "testlog-long.log", false);
     }