From f0fb1a66bb04972a1de46440cc30f04b74f41b1d Mon Sep 17 00:00:00 2001 From: Ninette Adhikari Date: Fri, 27 Sep 2024 11:38:15 +0200 Subject: [PATCH] refactor: Migrate log4j-jpl to junit5 Signed-off-by: Ninette Adhikari --- log4j-jpl/pom.xml | 5 ----- .../log4j/jpl/Log4jSystemLoggerTest.java | 18 +++++++++--------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/log4j-jpl/pom.xml b/log4j-jpl/pom.xml index 70345ff657e1..736a95f387b2 100644 --- a/log4j-jpl/pom.xml +++ b/log4j-jpl/pom.xml @@ -58,11 +58,6 @@ junit-jupiter-engine test - - org.junit.vintage - junit-vintage-engine - test - diff --git a/log4j-jpl/src/test/java/org/apache/logging/log4j/jpl/Log4jSystemLoggerTest.java b/log4j-jpl/src/test/java/org/apache/logging/log4j/jpl/Log4jSystemLoggerTest.java index 85cadb84e5f3..cac01a7f1548 100644 --- a/log4j-jpl/src/test/java/org/apache/logging/log4j/jpl/Log4jSystemLoggerTest.java +++ b/log4j-jpl/src/test/java/org/apache/logging/log4j/jpl/Log4jSystemLoggerTest.java @@ -16,13 +16,13 @@ */ package org.apache.logging.log4j.jpl; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.instanceOf; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; import java.lang.System.Logger; import java.util.List; @@ -30,9 +30,9 @@ import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.impl.Log4jLogEvent; import org.apache.logging.log4j.core.test.appender.ListAppender; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class Log4jSystemLoggerTest { @@ -41,7 +41,7 @@ public class Log4jSystemLoggerTest { protected ListAppender eventAppender; protected ListAppender stringAppender; - @Before + @BeforeEach public void setUp() throws Exception { logger = System.getLogger(LOGGER_NAME); assertThat(logger, instanceOf(Log4jSystemLogger.class)); @@ -51,7 +51,7 @@ public void setUp() throws Exception { assertNotNull(stringAppender); } - @After + @AfterEach public void tearDown() throws Exception { if (eventAppender != null) { eventAppender.clear();