You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2024/09/27 14:51:15 UTC

(logging-log4j2) branch main updated: Migrate `log4j-jpl` tests to JUnit 5 (#3029)

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

vy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/main by this push:
     new b6101b34b3 Migrate `log4j-jpl` tests to JUnit 5 (#3029)
b6101b34b3 is described below

commit b6101b34b3d51f8bd4e9f4278a6287f06149e3f9
Author: Ninette Adhikari <13...@users.noreply.github.com>
AuthorDate: Fri Sep 27 16:44:38 2024 +0200

    Migrate `log4j-jpl` tests to JUnit 5 (#3029)
    
    Signed-off-by: Ninette Adhikari <ni...@gmail.com>
---
 log4j-jpl/pom.xml                                      |  5 -----
 .../logging/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 ff8885492f..8f34451bee 100644
--- a/log4j-jpl/pom.xml
+++ b/log4j-jpl/pom.xml
@@ -57,10 +57,5 @@
       <artifactId>junit-jupiter-engine</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.junit.vintage</groupId>
-      <artifactId>junit-vintage-engine</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 </project>
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 7a75a6d4a9..4e137d02d6 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.Level;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.impl.MementoLogEvent;
 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 class Log4jSystemLoggerTest {
         assertNotNull(stringAppender);
     }
 
-    @After
+    @AfterEach
     public void tearDown() throws Exception {
         if (eventAppender != null) {
             eventAppender.clear();