Skip to content

Commit

Permalink
refactor: Migrate log4j-jpl to junit5
Browse files Browse the repository at this point in the history
Signed-off-by: Ninette Adhikari <[email protected]>
  • Loading branch information
ninetteadhikari committed Sep 27, 2024
1 parent 2e36e28 commit f0fb1a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
5 changes: 0 additions & 5 deletions log4j-jpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@
<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>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
*/
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;
import org.apache.logging.log4j.Level;
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 {

Expand All @@ -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));
Expand All @@ -51,7 +51,7 @@ public void setUp() throws Exception {
assertNotNull(stringAppender);
}

@After
@AfterEach
public void tearDown() throws Exception {
if (eventAppender != null) {
eventAppender.clear();
Expand Down

0 comments on commit f0fb1a6

Please sign in to comment.