This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 3609f5b7b97458bbf17ae7daa4d190e2499fd6c0 Author: Gary Gregory <[email protected]> AuthorDate: Thu Jul 25 08:48:51 2024 -0400 Add DefaultExceptionContextTest.testFormattedExceptionMessageNullValue() --- .../lang3/exception/DefaultExceptionContextTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/java/org/apache/commons/lang3/exception/DefaultExceptionContextTest.java b/src/test/java/org/apache/commons/lang3/exception/DefaultExceptionContextTest.java index 29100f266..ac7bfd0de 100644 --- a/src/test/java/org/apache/commons/lang3/exception/DefaultExceptionContextTest.java +++ b/src/test/java/org/apache/commons/lang3/exception/DefaultExceptionContextTest.java @@ -54,4 +54,17 @@ public class DefaultExceptionContextTest extends AbstractExceptionContextTest<De assertEquals("", exceptionContext.getFormattedExceptionMessage(null)); } + @Test + public void testFormattedExceptionMessageNullValue() { + exceptionContext = new DefaultExceptionContext(); + final String label1 = "throws 1"; + final String label2 = "throws 2"; + exceptionContext.addContextValue(label1, null); + exceptionContext.addContextValue(label2, null); + final String message = exceptionContext.getFormattedExceptionMessage(TEST_MESSAGE); + assertTrue(message.startsWith(TEST_MESSAGE)); + assertTrue(message.contains(label1)); + assertTrue(message.contains(label2)); + } + }
