You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2022/04/16 05:46:26 UTC

[logging-log4j2] branch release-2.x updated: Fix `log4j-jul` ApiLoggerTest

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

pkarwasz pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/release-2.x by this push:
     new bfc8004c42 Fix `log4j-jul` ApiLoggerTest
bfc8004c42 is described below

commit bfc8004c42ea70f370fb7691b8301d65fe1076b5
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Sat Apr 16 07:46:17 2022 +0200

    Fix `log4j-jul` ApiLoggerTest
    
    `setLevel` does not throw any more.
---
 .../test/java/org/apache/logging/log4j/jul/ApiLoggerTest.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/log4j-jul/src/test/java/org/apache/logging/log4j/jul/ApiLoggerTest.java b/log4j-jul/src/test/java/org/apache/logging/log4j/jul/ApiLoggerTest.java
index 0f2c830cd0..bb55819252 100644
--- a/log4j-jul/src/test/java/org/apache/logging/log4j/jul/ApiLoggerTest.java
+++ b/log4j-jul/src/test/java/org/apache/logging/log4j/jul/ApiLoggerTest.java
@@ -21,6 +21,7 @@ import static org.hamcrest.Matchers.equalTo;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
 
 import java.util.logging.Logger;
 
@@ -82,8 +83,12 @@ public class ApiLoggerTest extends AbstractLoggerTest {
         logger.setParent(null);
     }
 
-    @Test(expected = UnsupportedOperationException.class)
-    public void testSetLevelFails() throws Exception {
-        logger.setLevel(null);
+    @Test
+    public void testSetLevelDoesNotFail() throws Exception {
+        try {
+            logger.setLevel(null);
+        } catch (Throwable e) {
+            fail("should not throw");
+        }
     }
 }