From abcb59b167732df8e9ada2a3d9c196c032dce03c Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Wed, 22 Mar 2023 09:00:23 -0300 Subject: [PATCH] #1366 - Added unit test for java.sql.Date --- .../org/apache/logging/log4j/message/MapMessageTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/log4j-api-test/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java b/log4j-api-test/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java index eb83c09be37..355a257cfb6 100644 --- a/log4j-api-test/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java +++ b/log4j-api-test/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java @@ -17,6 +17,7 @@ package org.apache.logging.log4j.message; import java.math.BigDecimal; +import java.sql.Date; import java.sql.Time; import java.util.Arrays; import java.util.Collections; @@ -321,6 +322,14 @@ public void testTime() throws Exception { message.getFormattedMessage(), "Incorrect time format"); } + @Test + public void testDate() { + final Date date = new Date(System.currentTimeMillis()); + final ObjectMapMessage message = new ObjectMapMessage().with("date", date); + assertEquals("date=\"" + date + "\"", + message.getFormattedMessage(), "Incorrect date format"); + } + private static final class FormattableTestType implements StringBuilderFormattable { @Override