You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2026/08/27 17:43:24 UTC

(maven-integration-testing) branch maven-3.10.x updated: Test for color always output

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

slawekjaranowski pushed a commit to branch maven-3.10.x
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git


The following commit(s) were added to refs/heads/maven-3.10.x by this push:
     new d3b146846 Test for color always output
d3b146846 is described below

commit d3b1468466275a78d6381b996b78a3f88d1687e5
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon Apr 20 22:43:23 2026 +0200

    Test for color always output
---
 .../maven/it/MavenITgh11969ColorAlwaysTest.java    | 61 ++++++++++++++++++++++
 .../org/apache/maven/it/TestSuiteOrdering.java     |  1 +
 .../test/resources/gh-11969-color-always/pom.xml   | 11 ++++
 3 files changed, 73 insertions(+)

diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh11969ColorAlwaysTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh11969ColorAlwaysTest.java
new file mode 100644
index 000000000..34cb6c74a
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh11969ColorAlwaysTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.it;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.maven.shared.verifier.Verifier;
+import org.apache.maven.shared.verifier.util.ResourceExtractor;
+import org.junit.jupiter.api.Test;
+
+/**
+ * This is a test check that color always works.
+ */
+class MavenITgh11969ColorAlwaysTest extends AbstractMavenIntegrationTestCase {
+
+    MavenITgh11969ColorAlwaysTest() {
+        super("[3.10.0,)");
+    }
+
+    @Test
+    void testIt() throws Exception {
+        File basedir = ResourceExtractor.simpleExtractResources(getClass(), "/gh-11969-color-always");
+
+        Verifier verifier = newVerifier(basedir.getAbsolutePath());
+        verifier.addCliArguments("-color=always");
+        verifier.addCliArguments("validate");
+        verifier.addCliArguments("-X");
+        // only fork mode supports color output
+        verifier.setForkJvm(true);
+        verifier.execute();
+        verifier.verifyErrorFreeLog();
+
+        List<String> lines = verifier.loadLines(verifier.getLogFileName(), "UTF-8");
+        assertTrue(
+                String.join(System.lineSeparator(), lines),
+                lines.stream().anyMatch(l -> l.contains("\u001B[1mApache Maven")));
+        assertTrue(
+                String.join(System.lineSeparator(), lines),
+                lines.stream().anyMatch(l -> l.contains("[\u001B[36;1mDEBUG\u001B[0m]")));
+        assertTrue(
+                String.join(System.lineSeparator(), lines),
+                lines.stream().anyMatch(l -> l.contains("[\u001B[34;1mINFO\u001B[0m]")));
+    }
+}
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
index 8a7964ad5..14da52359 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
@@ -121,6 +121,7 @@ public class TestSuiteOrdering implements ClassOrderer {
          * a fail fast technique as well.
          */
 
+        suite.addTestSuite(MavenITgh11969ColorAlwaysTest.class);
         suite.addTestSuite(MavenITgh12668ExtensionDebugLevel.class);
         suite.addTestSuite(MavenITgh12288SettingsProfileAetherPropertiesTest.class);
         suite.addTestSuite(MavenITgh10312TerminallyDeprecatedMethodInGuiceTest.class);
diff --git a/core-it-suite/src/test/resources/gh-11969-color-always/pom.xml b/core-it-suite/src/test/resources/gh-11969-color-always/pom.xml
new file mode 100644
index 000000000..773bf1523
--- /dev/null
+++ b/core-it-suite/src/test/resources/gh-11969-color-always/pom.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.gh11969</groupId>
+  <artifactId>parent</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+</project>