From 276c6a8dc445cbaffb2bc2a6344f54abeb9b4311 Mon Sep 17 00:00:00 2001 From: Carlos Chacin Date: Mon, 22 Mar 2021 21:28:48 -0700 Subject: [PATCH] [MNG-7127] fix MavenCliTest.testStyleColors test in JDK 16 The MavenCliTest.testStyleColors is not failing when the build is under JDK 8 or JDK 11. After changing to JDK 16, the test fails, this commit is to fix the NullPointerException. Tested on JDK 8, 11 adn 16 with: `mvn clean verify` --- .../src/test/java/org/apache/maven/cli/MavenCliTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java index f9dbf08ae4..cf243fb79a 100644 --- a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java @@ -322,6 +322,7 @@ public class MavenCliTest MessageUtils.setColorEnabled( true ); request = new CliRequest( new String[] { "-l", "target/temp/mvn.log" }, null ); + request.workingDirectory = "target/temp"; cli.cli( request ); cli.properties( request ); cli.logging( request ); @@ -343,6 +344,7 @@ public class MavenCliTest MessageUtils.setColorEnabled( false ); request = new CliRequest( new String[] { "-Dstyle.color=always", "-B", "-l", "target/temp/mvn.log" }, null ); + request.workingDirectory = "target/temp"; cli.cli( request ); cli.properties( request ); cli.logging( request ); @@ -350,6 +352,7 @@ public class MavenCliTest MessageUtils.setColorEnabled( false ); CliRequest maybeColorRequest = new CliRequest( new String[] { "-Dstyle.color=maybe", "-B", "-l", "target/temp/mvn.log" }, null ); + request.workingDirectory = "target/temp"; cli.cli( maybeColorRequest ); cli.properties( maybeColorRequest ); assertThrows(