From d861f1b2116a41a45949d1401785220119a57e56 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sat, 25 May 2024 09:43:54 -0400 Subject: [PATCH] Add test cases for single quote processing --- .../apache/commons/lang3/time/DurationFormatUtilsTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java index 7a8c91746..7df279573 100644 --- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java @@ -461,11 +461,16 @@ public class DurationFormatUtilsTest extends AbstractLangTest { cal.set(Calendar.MILLISECOND, 0); time = cal.getTime().getTime(); assertEquals("40", DurationFormatUtils.formatPeriod(time1970, time, "yM")); + assertEquals("4 years 0 months", DurationFormatUtils.formatPeriod(time1970, time, "y' ''years' M 'months'")); assertEquals("4 years 0 months", DurationFormatUtils.formatPeriod(time1970, time, "y' years 'M' months'")); + assertEquals("4years 0months", DurationFormatUtils.formatPeriod(time1970, time, "y'years 'M'months'")); assertEquals("04/00", DurationFormatUtils.formatPeriod(time1970, time, "yy/MM")); assertEquals("48", DurationFormatUtils.formatPeriod(time1970, time, "M")); assertEquals("48", DurationFormatUtils.formatPeriod(time1970, time, "MM")); assertEquals("048", DurationFormatUtils.formatPeriod(time1970, time, "MMM")); + // no date in result + assertEquals("hello", DurationFormatUtils.formatPeriod(time1970, time, "'hello'")); + assertEquals("helloworld", DurationFormatUtils.formatPeriod(time1970, time, "'hello''world'")); } @Test