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/04/18 16:41:33 UTC

(logging-log4j2) branch main updated: Fix Error Prone bug

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 b4cff33d39 Fix Error Prone bug
b4cff33d39 is described below

commit b4cff33d3906752080917b0a730c6f23b1dd6ad9
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Thu Apr 18 18:41:28 2024 +0200

    Fix Error Prone bug
---
 .../core/config/plugins/convert/TypeConvertersTest.java    | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConvertersTest.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConvertersTest.java
index 403a22d784..a379b4d713 100644
--- a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConvertersTest.java
+++ b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConvertersTest.java
@@ -16,8 +16,7 @@
  */
 package org.apache.logging.log4j.core.config.plugins.convert;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.File;
 import java.math.BigDecimal;
@@ -214,16 +213,9 @@ public class TypeConvertersTest {
     }
 
     @Test
-    public void testConvert() throws Exception {
+    public void testConvert() {
         final Object actual =
                 DI.createInitializedFactory().getTypeConverter(clazz).convert(value, defaultValue);
-        final String assertionMessage = "\nGiven: " + value + "\nDefault: " + defaultValue;
-        if (expected != null && expected instanceof char[]) {
-            assertArrayEquals(assertionMessage, (char[]) expected, (char[]) actual);
-        } else if (expected != null && expected instanceof byte[]) {
-            assertArrayEquals(assertionMessage, (byte[]) expected, (byte[]) actual);
-        } else {
-            assertEquals(assertionMessage, expected, actual);
-        }
+        assertThat(actual).as("Given: `%s`, Default: `%s`", value, defaultValue).isEqualTo(expected);
     }
 }