Add test cases for single quote processing

This commit is contained in:
Gary Gregory 2024-05-25 09:43:54 -04:00
parent 65e57efd2b
commit d861f1b211
1 changed files with 5 additions and 0 deletions

View File

@ -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