LANG-815 DurationFormatUtils.formatPeriod() mis-calculation

Add test case to show there is no issue

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1390971 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-09-27 12:46:42 +00:00
parent 77eed078c8
commit cfab1e4fa1
1 changed files with 13 additions and 1 deletions

View File

@ -399,6 +399,18 @@ public class DurationFormatUtilsTest {
new int[] { 2006, 9, 6, 0, 0, 0 }, "MM");
}
@Test
public void testLANG815() {
Calendar calendar = Calendar.getInstance();
calendar.set(2012, 6, 30, 0, 0, 0);
long startMillis = calendar.getTimeInMillis();
calendar.set(2012, 8, 8);
long endMillis = calendar.getTimeInMillis();
assertEquals("1 9", DurationFormatUtils.formatPeriod(startMillis, endMillis, "M d"));
}
// Testing the under a day range in DurationFormatUtils.formatPeriod
@Test
public void testLowDurations() {