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

gnodet pushed a commit to branch stacked/build-report
in repository https://gitbox.apache.org/repos/asf/maven.git

commit fdb130bf686a9c18c6e913d80f879d38dd46dd25
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Nov 12 13:47:25 2026 +0000

    fix: remove stale MavenSimpleLogger tests that reference removed 
writeThrowable API
    
    The 'slim down SLF4J adapter' commit (67724c6) rewrote MavenSimpleLogger
    as a thin LegacyAbstractLogger bridge to LogSink, removing the
    MavenBaseLogger inheritance and the writeThrowable() methods.
    
    Two tests in MavenSimpleLoggerTest were left over from before the refactor:
    - includesCauseAndSuppressedExceptionsWhenWritingThrowables: called
      writeThrowable(Throwable, PrintStream) which no longer exists on
      MavenSimpleLogger
    - writeThrowableTruncatesAtMaxDepth: called writeThrowable(Throwable,
      Consumer<String>) which never existed on MavenSimpleLogger
    
    The writeThrowable formatting behavior is still tested in
    MavenBaseLoggerTimestampTest via MavenBaseLogger. The two remaining tests
    verify the new sink-based routing behavior.
---
 .../maven/logging/slf4j/MavenSimpleLoggerTest.java | 93 +---------------------
 1 file changed, 1 insertion(+), 92 deletions(-)

diff --git 
a/impl/maven-logging-slf4j/src/test/java/org/apache/maven/logging/slf4j/MavenSimpleLoggerTest.java
 
b/impl/maven-logging-slf4j/src/test/java/org/apache/maven/logging/slf4j/MavenSimpleLoggerTest.java
index e5b90ec9e8..3b5effec06 100644
--- 
a/impl/maven-logging-slf4j/src/test/java/org/apache/maven/logging/slf4j/MavenSimpleLoggerTest.java
+++ 
b/impl/maven-logging-slf4j/src/test/java/org/apache/maven/logging/slf4j/MavenSimpleLoggerTest.java
@@ -18,91 +18,23 @@
  */
 package org.apache.maven.logging.slf4j;
 
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
-import java.util.NoSuchElementException;
 
 import org.apache.maven.api.logging.LogEvent;
 import org.apache.maven.api.logging.LogLevel;
-import org.apache.maven.api.logging.LogSink;
 import org.apache.maven.api.logging.LoggerManager;
-import org.apache.maven.jline.MessageUtils;
 import org.apache.maven.logging.impl.DefaultLoggerManager;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.TestInfo;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertLinesMatch;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 class MavenSimpleLoggerTest {
 
-    boolean colorEnabled;
-
-    @BeforeEach
-    void setup() {
-        colorEnabled = MessageUtils.isColorEnabled();
-        MessageUtils.setColorEnabled(false);
-    }
-
-    @AfterEach
-    void tearDown() {
-        MessageUtils.setColorEnabled(colorEnabled);
-    }
-
-    @Test
-    void includesCauseAndSuppressedExceptionsWhenWritingThrowables(TestInfo 
testInfo) {
-        Exception causeOfSuppressed = new NoSuchElementException("cause of 
suppressed");
-        Exception suppressed = new IllegalStateException("suppressed", 
causeOfSuppressed);
-        suppressed.addSuppressed(new IllegalArgumentException(
-                "suppressed suppressed", new 
ArrayIndexOutOfBoundsException("suppressed suppressed cause")));
-        Exception cause = new IllegalArgumentException("cause");
-        cause.addSuppressed(suppressed);
-        Exception throwable = new RuntimeException("top-level", cause);
-
-        ByteArrayOutputStream output = new ByteArrayOutputStream();
-
-        new MavenSimpleLogger("logger").writeThrowable(throwable, new 
PrintStream(output));
-
-        String actual = output.toString(UTF_8);
-        List<String> actualLines = 
Arrays.asList(actual.split(System.lineSeparator()));
-
-        Class<?> testClass = testInfo.getTestClass().get();
-        String testMethodName = testInfo.getTestMethod().get().getName();
-        String testClassStackTraceLinePattern = "at " + testClass.getName() + 
"." + testMethodName + "\\("
-                + testClass.getSimpleName() + ".java:\\d+\\)";
-        List<String> expectedLines = Arrays.asList(
-                "java.lang.RuntimeException: top-level",
-                "    " + testClassStackTraceLinePattern,
-                ">> stacktrace >>",
-                "Caused by: java.lang.IllegalArgumentException: cause",
-                "    " + testClassStackTraceLinePattern,
-                ">> stacktrace >>",
-                "    Suppressed: java.lang.IllegalStateException: suppressed",
-                "        " + testClassStackTraceLinePattern,
-                ">> stacktrace >>",
-                "        Suppressed: java.lang.IllegalArgumentException: 
suppressed suppressed",
-                "            " + testClassStackTraceLinePattern,
-                ">> stacktrace >>",
-                "        Caused by: java.lang.ArrayIndexOutOfBoundsException: 
suppressed suppressed cause",
-                "            " + testClassStackTraceLinePattern,
-                ">> stacktrace >>",
-                "    Caused by: java.util.NoSuchElementException: cause of 
suppressed",
-                "        " + testClassStackTraceLinePattern,
-                ">> stacktrace >>");
-
-        assertLinesMatch(expectedLines, actualLines);
-    }
-
     /**
-     * Verify that when a {@link LogSink} is installed via {@link 
LoggerManager},
+     * Verify that when a log sink is installed via {@link LoggerManager},
      * {@code MavenSimpleLogger} routes events to the sink instead of stdout.
      */
     @Test
@@ -127,29 +59,6 @@ void writeRoutesToSinkWhenInstalled() {
         }
     }
 
-    /**
-     * Verify that a deeply nested cause chain is truncated at 
MAX_THROWABLE_DEPTH
-     * and that a truncation notice is emitted.
-     */
-    @Test
-    void writeThrowableTruncatesAtMaxDepth() {
-        // Build a cause chain of depth 21 — one beyond the limit of 20
-        RuntimeException root = new RuntimeException("root");
-        RuntimeException current = root;
-        for (int i = 0; i < 21; i++) {
-            RuntimeException next = new RuntimeException("cause-" + i);
-            current.initCause(next);
-            current = next;
-        }
-
-        List<String> lines = new ArrayList<>();
-        new MavenSimpleLogger("test").writeThrowable(root, lines::add);
-
-        assertTrue(
-                lines.stream().anyMatch(l -> l.contains("truncated at depth")),
-                "Expected a truncation notice after reaching 
MAX_THROWABLE_DEPTH");
-    }
-
     /**
      * Verify that when a throwable is present, the sink receives a {@link 
LogEvent}
      * with the exception accessible via {@link LogEvent#throwable()}.

Reply via email to