Added unit test for LANG-140 - thanks to Yu Peng for the test case

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@415316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2006-06-19 12:47:28 +00:00
parent d13e4b12f3
commit 30753fb56a
1 changed files with 13 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package org.apache.commons.lang.time;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import junit.framework.Test;
@ -397,6 +398,18 @@ public class DurationFormatUtilsTest extends TestCase {
assertTrue("Token with Number value not equal to itself. ", numToken.equals(numToken));
}
// http://issues.apache.org/bugzilla/show_bug.cgi?id=38401
public void testBugzilla38401() {
Calendar cal1 = Calendar.getInstance();
cal1.set(2006, 0, 26, 18, 47, 34);
Calendar cal2 = Calendar.getInstance();
cal2.set(2006, 1, 26, 10, 47, 34);
System.err.println("WAS: " + DurationFormatUtils.formatPeriod(cal1.getTime().getTime(), cal2.getTime().getTime(), "yyyy/MM/dd HH:mm:ss SSS") );
assertEquals( "0000/00/30 16:00:00 000", DurationFormatUtils.formatPeriod(cal1.getTime().getTime(), cal2.getTime().getTime(), "yyyy/MM/dd HH:mm:ss SSS") );
}
private void assertArrayEquals(DurationFormatUtils.Token[] obj1, DurationFormatUtils.Token[] obj2) {
assertEquals("Arrays are unequal length. ", obj1.length, obj2.length);
for (int i = 0; i < obj1.length; i++) {