Fix formatting

This commit is contained in:
Gary Gregory 2022-12-07 09:41:42 -05:00
parent f55164f28e
commit 7b732b7a26
1 changed files with 35 additions and 35 deletions

View File

@ -73,7 +73,7 @@ public class DurationFormatUtilsTest extends AbstractLangTest {
array2[1] = c.get(Calendar.MONTH);
array2[2] = c.get(Calendar.DAY_OF_MONTH);
final String tmpMsg = msg + array2[0] + "-" + array2[1] + "-" + array2[2] + " at ";
assertEqualDuration( tmpMsg + i, Integer.toString(i), array1, array2, format );
assertEqualDuration(tmpMsg + i, Integer.toString(i), array1, array2, format );
c.add(calendarType, 1);
}
}
@ -81,7 +81,7 @@ public class DurationFormatUtilsTest extends AbstractLangTest {
/** https://issues.apache.org/bugzilla/show_bug.cgi?id=38401 */
@Test
public void testBugzilla38401() {
assertEqualDuration( "0000/00/30 16:00:00 000", new int[] { 2006, 0, 26, 18, 47, 34 },
assertEqualDuration("0000/00/30 16:00:00 000", new int[] { 2006, 0, 26, 18, 47, 34 },
new int[] { 2006, 1, 26, 10, 47, 34 }, "yyyy/MM/dd HH:mm:ss SSS");
}
@ -113,90 +113,90 @@ public class DurationFormatUtilsTest extends AbstractLangTest {
public void testEdgeDurations() {
// This test case must use a time zone without DST
TimeZone.setDefault(FastTimeZone.getGmtTimeZone());
assertEqualDuration( "01", new int[] { 2006, 0, 15, 0, 0, 0 },
assertEqualDuration("01", new int[] { 2006, 0, 15, 0, 0, 0 },
new int[] { 2006, 2, 10, 0, 0, 0 }, "MM");
assertEqualDuration( "12", new int[] { 2005, 0, 15, 0, 0, 0 },
assertEqualDuration("12", new int[] { 2005, 0, 15, 0, 0, 0 },
new int[] { 2006, 0, 15, 0, 0, 0 }, "MM");
assertEqualDuration( "12", new int[] { 2005, 0, 15, 0, 0, 0 },
assertEqualDuration("12", new int[] { 2005, 0, 15, 0, 0, 0 },
new int[] { 2006, 0, 16, 0, 0, 0 }, "MM");
assertEqualDuration( "11", new int[] { 2005, 0, 15, 0, 0, 0 },
assertEqualDuration("11", new int[] { 2005, 0, 15, 0, 0, 0 },
new int[] { 2006, 0, 14, 0, 0, 0 }, "MM");
assertEqualDuration( "01 26", new int[] { 2006, 0, 15, 0, 0, 0 },
assertEqualDuration("01 26", new int[] { 2006, 0, 15, 0, 0, 0 },
new int[] { 2006, 2, 10, 0, 0, 0 }, "MM dd");
assertEqualDuration( "54", new int[] { 2006, 0, 15, 0, 0, 0 },
assertEqualDuration("54", new int[] { 2006, 0, 15, 0, 0, 0 },
new int[] { 2006, 2, 10, 0, 0, 0 }, "dd");
assertEqualDuration( "09 12", new int[] { 2006, 1, 20, 0, 0, 0 },
assertEqualDuration("09 12", new int[] { 2006, 1, 20, 0, 0, 0 },
new int[] { 2006, 11, 4, 0, 0, 0 }, "MM dd");
assertEqualDuration( "287", new int[] { 2006, 1, 20, 0, 0, 0 },
assertEqualDuration("287", new int[] { 2006, 1, 20, 0, 0, 0 },
new int[] { 2006, 11, 4, 0, 0, 0 }, "dd");
assertEqualDuration( "11 30", new int[] { 2006, 0, 2, 0, 0, 0 },
assertEqualDuration("11 30", new int[] { 2006, 0, 2, 0, 0, 0 },
new int[] { 2007, 0, 1, 0, 0, 0 }, "MM dd");
assertEqualDuration( "364", new int[] { 2006, 0, 2, 0, 0, 0 },
assertEqualDuration("364", new int[] { 2006, 0, 2, 0, 0, 0 },
new int[] { 2007, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "12 00", new int[] { 2006, 0, 1, 0, 0, 0 },
assertEqualDuration("12 00", new int[] { 2006, 0, 1, 0, 0, 0 },
new int[] { 2007, 0, 1, 0, 0, 0 }, "MM dd");
assertEqualDuration( "365", new int[] { 2006, 0, 1, 0, 0, 0 },
assertEqualDuration("365", new int[] { 2006, 0, 1, 0, 0, 0 },
new int[] { 2007, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "31", new int[] { 2006, 0, 1, 0, 0, 0 },
assertEqualDuration("31", new int[] { 2006, 0, 1, 0, 0, 0 },
new int[] { 2006, 1, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "92", new int[] { 2005, 9, 1, 0, 0, 0 },
assertEqualDuration("92", new int[] { 2005, 9, 1, 0, 0, 0 },
new int[] { 2006, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "77", new int[] { 2005, 9, 16, 0, 0, 0 },
assertEqualDuration("77", new int[] { 2005, 9, 16, 0, 0, 0 },
new int[] { 2006, 0, 1, 0, 0, 0 }, "dd");
// test month larger in start than end
assertEqualDuration( "136", new int[] { 2005, 9, 16, 0, 0, 0 },
assertEqualDuration("136", new int[] { 2005, 9, 16, 0, 0, 0 },
new int[] { 2006, 2, 1, 0, 0, 0 }, "dd");
// test when start in leap year
assertEqualDuration( "136", new int[] { 2004, 9, 16, 0, 0, 0 },
assertEqualDuration("136", new int[] { 2004, 9, 16, 0, 0, 0 },
new int[] { 2005, 2, 1, 0, 0, 0 }, "dd");
// test when end in leap year
assertEqualDuration( "137", new int[] { 2003, 9, 16, 0, 0, 0 },
assertEqualDuration("137", new int[] { 2003, 9, 16, 0, 0, 0 },
new int[] { 2004, 2, 1, 0, 0, 0 }, "dd");
// test when end in leap year but less than end of feb
assertEqualDuration( "135", new int[] { 2003, 9, 16, 0, 0, 0 },
assertEqualDuration("135", new int[] { 2003, 9, 16, 0, 0, 0 },
new int[] { 2004, 1, 28, 0, 0, 0 }, "dd");
assertEqualDuration( "364", new int[] { 2007, 0, 2, 0, 0, 0 },
assertEqualDuration("364", new int[] { 2007, 0, 2, 0, 0, 0 },
new int[] { 2008, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "729", new int[] { 2006, 0, 2, 0, 0, 0 },
assertEqualDuration("729", new int[] { 2006, 0, 2, 0, 0, 0 },
new int[] { 2008, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "365", new int[] { 2007, 2, 2, 0, 0, 0 },
assertEqualDuration("365", new int[] { 2007, 2, 2, 0, 0, 0 },
new int[] { 2008, 2, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "333", new int[] { 2007, 1, 2, 0, 0, 0 },
assertEqualDuration("333", new int[] { 2007, 1, 2, 0, 0, 0 },
new int[] { 2008, 0, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "28", new int[] { 2008, 1, 2, 0, 0, 0 },
assertEqualDuration("28", new int[] { 2008, 1, 2, 0, 0, 0 },
new int[] { 2008, 2, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "393", new int[] { 2007, 1, 2, 0, 0, 0 },
assertEqualDuration("393", new int[] { 2007, 1, 2, 0, 0, 0 },
new int[] { 2008, 2, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "369", new int[] { 2004, 0, 29, 0, 0, 0 },
assertEqualDuration("369", new int[] { 2004, 0, 29, 0, 0, 0 },
new int[] { 2005, 1, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "338", new int[] { 2004, 1, 29, 0, 0, 0 },
assertEqualDuration("338", new int[] { 2004, 1, 29, 0, 0, 0 },
new int[] { 2005, 1, 1, 0, 0, 0 }, "dd");
assertEqualDuration( "28", new int[] { 2004, 2, 8, 0, 0, 0 },
assertEqualDuration("28", new int[] { 2004, 2, 8, 0, 0, 0 },
new int[] { 2004, 3, 5, 0, 0, 0 }, "dd");
assertEqualDuration( "48", new int[] { 1992, 1, 29, 0, 0, 0 },
assertEqualDuration("48", new int[] { 1992, 1, 29, 0, 0, 0 },
new int[] { 1996, 1, 29, 0, 0, 0 }, "M");
// this seems odd - and will fail if I throw it in as a brute force
// below as it expects the answer to be 12. It's a tricky edge case
assertEqualDuration( "11", new int[] { 1996, 1, 29, 0, 0, 0 },
assertEqualDuration("11", new int[] { 1996, 1, 29, 0, 0, 0 },
new int[] { 1997, 1, 28, 0, 0, 0 }, "M");
// again - this seems odd
assertEqualDuration( "11 28", new int[] { 1996, 1, 29, 0, 0, 0 },
assertEqualDuration("11 28", new int[] { 1996, 1, 29, 0, 0, 0 },
new int[] { 1997, 1, 28, 0, 0, 0 }, "M d");
}
@ -511,7 +511,7 @@ public class DurationFormatUtilsTest extends AbstractLangTest {
// https://issues.apache.org/jira/browse/LANG-281
@Test
public void testJiraLang281() {
assertEqualDuration( "09", new int[] { 2005, 11, 31, 0, 0, 0 },
assertEqualDuration("09", new int[] { 2005, 11, 31, 0, 0, 0 },
new int[] { 2006, 9, 6, 0, 0, 0 }, "MM");
}
@ -619,7 +619,7 @@ public class DurationFormatUtilsTest extends AbstractLangTest {
for (int hr=0; hr < 24; hr++) {
for (int min=0; min < 60; min++) {
for (int sec=0; sec < 60; sec++) {
assertEqualDuration( hr + ":" + min + ":" + sec,
assertEqualDuration(hr + ":" + min + ":" + sec,
new int[] { 2000, 0, 1, 0, 0, 0, 0 },
new int[] { 2000, 0, 1, hr, min, sec },
"H:m:s"