From 4200895ea661f9116fcdafd612ba8cffd64e7391 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Fri, 21 Oct 2022 02:23:40 +1100 Subject: [PATCH] test passes in multiple JDKs --- .../java/io/github/nalbion/TestAppenderTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test/java/io/github/nalbion/TestAppenderTest.java b/src/test/java/io/github/nalbion/TestAppenderTest.java index fdb1722..d1f983b 100644 --- a/src/test/java/io/github/nalbion/TestAppenderTest.java +++ b/src/test/java/io/github/nalbion/TestAppenderTest.java @@ -44,13 +44,15 @@ void shouldAssertLogsWithStackTrace() { logger.error("Caught exception", e); logger.info("Message after stacktrace"); - testAppender.assertLogs("Hello World!\n" + testAppender.assertLogs(line -> + line.replaceAll("java.base/jdk.internal([A-Za-z \\d.(]+)(:\\d+)?\\)", "sun$1)"), + "Hello World!\n" + "Caught exception\n" + "java.lang.RuntimeException: Forced error\n" - + " at io.github.nalbion.TestAppenderTest.shouldAssertLogsWithStackTrace(TestAppenderTest.java:44)\n" - + " at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" - + " at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)\n" - + " at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" + + " at io.github.nalbion.TestAppenderTest.shouldAssertLogsWithStackTrace(TestAppenderTest.java:42)\n" + + " at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" + + " at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)\n" + + " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)\n" + "Message after stacktrace"); } }