Closed amir9979 closed 3 years ago
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Regression,-1,commons-lang,cf03e6173b70ad64337704402bea51600cddd1ba,708da45999d8e545bfbae17a092c68df94061756,org.apache.commons.lang3.math.NumberUtilsTest.testLANG992,False,[],,,,org.apache.commons.lang3.math.numberutils.isnumber(string),"u'diff --git a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java\nindex ea895e256..919020f31 100644\n--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java\n@@ -1234,6 +1234,12 @@ public class NumberUtilsTest {\n compareIsNumberWithCreateNumber(""00"", true);\n }\n \n+ @Test\n+ public void testLANG992() {\n+ compareIsNumberWithCreateNumber(""0.0"", true);\n+ compareIsNumberWithCreateNumber(""0.4790"", true);\n+ }\n+\n @Test\n public void testLANG972() {\n compareIsNumberWithCreateNumber(""0xABCD"", true);'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Delta,-1,commons-lang,22b6781a0b96418198dc9146e5191e51d381102f,2aae22de23bf47566700c0ca2671d25e30c4a857,org.apache.commons.lang3.time.FastDateFormatTest.testParseSync,False,[],,,,"org.apache.commons.lang3.time.fastdateparser.getstrategy(string,calendar)@org.apache.commons.lang3.time.fastdateprinter.parsepattern()","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\nindex 2d8984218..3b0d11fa4 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n@@ -17,10 +17,13 @@\n package org.apache.commons.lang3.time;\n \n import org.junit.Test;\n+\n import static org.junit.Assert.;\n+\n import java.lang.reflect.Constructor;\n import java.lang.reflect.Modifier;\n import java.util.Calendar;\n+import java.util.Date;\n import java.util.Locale;\n import java.util.TimeZone;\n \n@@ -103,7 +106,7 @@ public class DateFormatUtilsTest {\n }\n \n @Test\n- public void testDateTimeISO(){\n+ public void testDateTimeISO() throws Exception {\n final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n final Calendar cal = Calendar.getInstance(timeZone);\n cal.set(2002,1,23,9,11,12);\n@@ -124,6 +127,14 @@ public class DateFormatUtilsTest {\n assertEquals(""2002-02-23T09:11:12-03:00"", text);\n text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n assertEquals(""2002-02-23T09:11:12-03:00"", text);\n+ \n+ Calendar utcCal = Calendar.getInstance(TimeZone.getTimeZone(""UTC""));\n+ utcCal.set(2002, 1, 23, 9, 11, 12);\n+ utcCal.set(Calendar.MILLISECOND, 0);\n+ text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(utcCal);\n+ assertEquals(""2002-02-23T09:11:12Z"", text);\n+ Date date = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(text);\n+ assertEquals(utcCal.getTime(), date);\n }\n \n @Test\n@@ -249,4 +260,9 @@ public class DateFormatUtilsTest {\n }\n /\n \n+ @Test\n+ public void testLANG1000() throws Exception {\n+ String date = ""2013-11-18T12:48:05Z"";\n+ DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(date);\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\nindex eeca7c21d..5b7fc257d 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n@@ -16,10 +16,7 @@\n /\n package org.apache.commons.lang3.time;\n \n-import static org.junit.Assert.assertNotNull;\n-import static org.junit.Assert.assertEquals;\n-import static org.junit.Assert.assertFalse;\n-import static org.junit.Assert.assertTrue;\n+import static org.junit.Assert.;\n \n import java.io.Serializable;\n import java.text.SimpleDateFormat;\n@@ -286,4 +283,17 @@ public class FastDatePrinterTest {\n final String actualValue = FastDateFormat.getInstance(pattern).format(cal);\n assertEquals(expectedValue, actualValue);\n }\n+ \n+ @Test\n+ public void testTimeZoneAsZ() throws Exception {\n+ Calendar c = Calendar.getInstance(TimeZone.getTimeZone(""UTC""));\n+ FastDateFormat noColonFormat = FastDateFormat.getInstance(""Z"");\n+ assertEquals(""+0000"", noColonFormat.format(c));\n+ \n+ FastDateFormat isoFormat = FastDateFormat.getInstance(""ZZ"");\n+ assertEquals(""Z"", isoFormat.format(c));\n+ \n+ FastDateFormat colonFormat = FastDateFormat.getInstance(""ZZZ"");\n+ assertEquals(""+00:00"", colonFormat.format(c));\n+ }\n }'" True,Delta,-1,commons-lang,22b6781a0b96418198dc9146e5191e51d381102f,2aae22de23bf47566700c0ca2671d25e30c4a857,org.apache.commons.lang3.time.DateFormatUtilsTest.testDateTimeISO,False,[],,,,"org.apache.commons.lang3.time.fastdateparser.getstrategy(string,calendar)@org.apache.commons.lang3.time.fastdateprinter.parsepattern()","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\nindex 2d8984218..3b0d11fa4 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n@@ -17,10 +17,13 @@\n package org.apache.commons.lang3.time;\n \n import org.junit.Test;\n+\n import static org.junit.Assert.;\n+\n import java.lang.reflect.Constructor;\n import java.lang.reflect.Modifier;\n import java.util.Calendar;\n+import java.util.Date;\n import java.util.Locale;\n import java.util.TimeZone;\n \n@@ -103,7 +106,7 @@ public class DateFormatUtilsTest {\n }\n \n @Test\n- public void testDateTimeISO(){\n+ public void testDateTimeISO() throws Exception {\n final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n final Calendar cal = Calendar.getInstance(timeZone);\n cal.set(2002,1,23,9,11,12);\n@@ -124,6 +127,14 @@ public class DateFormatUtilsTest {\n assertEquals(""2002-02-23T09:11:12-03:00"", text);\n text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n assertEquals(""2002-02-23T09:11:12-03:00"", text);\n+ \n+ Calendar utcCal = Calendar.getInstance(TimeZone.getTimeZone(""UTC""));\n+ utcCal.set(2002, 1, 23, 9, 11, 12);\n+ utcCal.set(Calendar.MILLISECOND, 0);\n+ text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(utcCal);\n+ assertEquals(""2002-02-23T09:11:12Z"", text);\n+ Date date = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(text);\n+ assertEquals(utcCal.getTime(), date);\n }\n \n @Test\n@@ -249,4 +260,9 @@ public class DateFormatUtilsTest {\n }\n /\n \n+ @Test\n+ public void testLANG1000() throws Exception {\n+ String date = ""2013-11-18T12:48:05Z"";\n+ DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(date);\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\nindex eeca7c21d..5b7fc257d 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n@@ -16,10 +16,7 @@\n /\n package org.apache.commons.lang3.time;\n \n-import static org.junit.Assert.assertNotNull;\n-import static org.junit.Assert.assertEquals;\n-import static org.junit.Assert.assertFalse;\n-import static org.junit.Assert.assertTrue;\n+import static org.junit.Assert.;\n \n import java.io.Serializable;\n import java.text.SimpleDateFormat;\n@@ -286,4 +283,17 @@ public class FastDatePrinterTest {\n final String actualValue = FastDateFormat.getInstance(pattern).format(cal);\n assertEquals(expectedValue, actualValue);\n }\n+ \n+ @Test\n+ public void testTimeZoneAsZ() throws Exception {\n+ Calendar c = Calendar.getInstance(TimeZone.getTimeZone(""UTC""));\n+ FastDateFormat noColonFormat = FastDateFormat.getInstance(""Z"");\n+ assertEquals(""+0000"", noColonFormat.format(c));\n+ \n+ FastDateFormat isoFormat = FastDateFormat.getInstance(""ZZ"");\n+ assertEquals(""Z"", isoFormat.format(c));\n+ \n+ FastDateFormat colonFormat = FastDateFormat.getInstance(""ZZZ"");\n+ assertEquals(""+00:00"", colonFormat.format(c));\n+ }\n }'" True,Regression,-1,commons-lang,22b6781a0b96418198dc9146e5191e51d381102f,2aae22de23bf47566700c0ca2671d25e30c4a857,org.apache.commons.lang3.time.FastDatePrinterTest.testTimeZoneAsZ,False,[],,,,"org.apache.commons.lang3.time.fastdateparser.getstrategy(string,calendar)@org.apache.commons.lang3.time.fastdateprinter.parsepattern()","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\nindex 2d8984218..3b0d11fa4 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n@@ -17,10 +17,13 @@\n package org.apache.commons.lang3.time;\n \n import org.junit.Test;\n+\n import static org.junit.Assert.;\n+\n import java.lang.reflect.Constructor;\n import java.lang.reflect.Modifier;\n import java.util.Calendar;\n+import java.util.Date;\n import java.util.Locale;\n import java.util.TimeZone;\n \n@@ -103,7 +106,7 @@ public class DateFormatUtilsTest {\n }\n \n @Test\n- public void testDateTimeISO(){\n+ public void testDateTimeISO() throws Exception {\n final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n final Calendar cal = Calendar.getInstance(timeZone);\n cal.set(2002,1,23,9,11,12);\n@@ -124,6 +127,14 @@ public class DateFormatUtilsTest {\n assertEquals(""2002-02-23T09:11:12-03:00"", text);\n text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n assertEquals(""2002-02-23T09:11:12-03:00"", text);\n+ \n+ Calendar utcCal = Calendar.getInstance(TimeZone.getTimeZone(""UTC""));\n+ utcCal.set(2002, 1, 23, 9, 11, 12);\n+ utcCal.set(Calendar.MILLISECOND, 0);\n+ text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(utcCal);\n+ assertEquals(""2002-02-23T09:11:12Z"", text);\n+ Date date = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(text);\n+ assertEquals(utcCal.getTime(), date);\n }\n \n @Test\n@@ -249,4 +260,9 @@ public class DateFormatUtilsTest {\n }\n /\n \n+ @Test\n+ public void testLANG1000() throws Exception {\n+ String date = ""2013-11-18T12:48:05Z"";\n+ DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(date);\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\nindex eeca7c21d..5b7fc257d 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n@@ -16,10 +16,7 @@\n /\n package org.apache.commons.lang3.time;\n \n-import static org.junit.Assert.assertNotNull;\n-import static org.junit.Assert.assertEquals;\n-import static org.junit.Assert.assertFalse;\n-import static org.junit.Assert.assertTrue;\n+import static org.junit.Assert.;\n \n import java.io.Serializable;\n import java.text.SimpleDateFormat;\n@@ -286,4 +283,17 @@ public class FastDatePrinterTest {\n final String actualValue = FastDateFormat.getInstance(pattern).format(cal);\n assertEquals(expectedValue, actualValue);\n }\n+ \n+ @Test\n+ public void testTimeZoneAsZ() throws Exception {\n+ Calendar c = Calendar.getInstance(TimeZone.getTimeZone(""UTC""));\n+ FastDateFormat noColonFormat = FastDateFormat.getInstance(""Z"");\n+ assertEquals(""+0000"", noColonFormat.format(c));\n+ \n+ FastDateFormat isoFormat = FastDateFormat.getInstance(""ZZ"");\n+ assertEquals(""Z"", isoFormat.format(c));\n+ \n+ FastDateFormat colonFormat = FastDateFormat.getInstance(""ZZZ"");\n+ assertEquals(""+00:00"", colonFormat.format(c));\n+ }\n }'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Delta,-1,commons-lang,fbb0f7f88c84001e0a92dae6a71b7e43bda65a56,d99f581745097c9562f1d701a6da66cd81a550f2,org.apache.commons.lang3.text.WordUtilsTest.testWrap_StringInt,False,[],,,,"org.apache.commons.lang3.text.wordutils.wrap(string,int,string,boolean)","u'diff --git a/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java b/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java\nindex 417751c52..6be8ded79 100644\n--- a/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java\n@@ -71,6 +71,12 @@ public class WordUtilsTest {\n expected = ""Click here,"" + systemNewLine + ""http://commons.apache.org,"" + systemNewLine \n + ""to jump to the"" + systemNewLine + ""commons website"";\n assertEquals(expected, WordUtils.wrap(input, 20));\n+\n+ // leading spaces on a new line are stripped\n+ // trailing spaces are not stripped\n+ input = ""word1 word2 word3"";\n+ expected = ""word1 "" + systemNewLine + ""word2 "" + systemNewLine + ""word3"";\n+ assertEquals(expected, WordUtils.wrap(input, 7));\n }\n \n @Test'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Regression,-1,commons-lang,80bd3fdb42a5d816ded9d9111c7dac3ce57c3101,66a37174a0398d76ff95904c22e77bc65890eec0,org.apache.commons.lang3.time.DateUtilsFragmentTest.testDaysOfMonthWithDate,False,[],,,,"org.apache.commons.lang3.time.dateutils.getfragment(calendar,int,int)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\nindex dfd2e2741..de9d7c6f2 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\n@@ -561,4 +561,32 @@ testResult);\n / DateUtils.MILLIS_PER_HOUR,\n testResult);\n }\n+ \n+ @Test\n+ public void testDaysOfMonthWithCalendar() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.MONTH);\n+ assertEquals(days, testResult);\n+ }\n+ \n+ @Test\n+ public void testDaysOfMonthWithDate() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.MONTH);\n+ final Calendar cal = Calendar.getInstance();\n+ cal.setTime(aDate);\n+ assertEquals(cal.get(Calendar.DAY_OF_MONTH), testResult);\n+ } \n+ \n+ @Test\n+ public void testDaysOfYearWithCalendar() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.YEAR);\n+ assertEquals(aCalendar.get(Calendar.DAY_OF_YEAR), testResult);\n+ }\n+ \n+ @Test\n+ public void testDaysOfYearWithDate() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.YEAR);\n+ final Calendar cal = Calendar.getInstance();\n+ cal.setTime(aDate);\n+ assertEquals(cal.get(Calendar.DAY_OF_YEAR), testResult);\n+ }\n }'" True,Regression,-1,commons-lang,80bd3fdb42a5d816ded9d9111c7dac3ce57c3101,66a37174a0398d76ff95904c22e77bc65890eec0,org.apache.commons.lang3.time.DateUtilsFragmentTest.testDaysOfMonthWithCalendar,False,[],,,,"org.apache.commons.lang3.time.dateutils.getfragment(calendar,int,int)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\nindex dfd2e2741..de9d7c6f2 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\n@@ -561,4 +561,32 @@ testResult);\n / DateUtils.MILLIS_PER_HOUR,\n testResult);\n }\n+ \n+ @Test\n+ public void testDaysOfMonthWithCalendar() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.MONTH);\n+ assertEquals(days, testResult);\n+ }\n+ \n+ @Test\n+ public void testDaysOfMonthWithDate() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.MONTH);\n+ final Calendar cal = Calendar.getInstance();\n+ cal.setTime(aDate);\n+ assertEquals(cal.get(Calendar.DAY_OF_MONTH), testResult);\n+ } \n+ \n+ @Test\n+ public void testDaysOfYearWithCalendar() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.YEAR);\n+ assertEquals(aCalendar.get(Calendar.DAY_OF_YEAR), testResult);\n+ }\n+ \n+ @Test\n+ public void testDaysOfYearWithDate() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.YEAR);\n+ final Calendar cal = Calendar.getInstance();\n+ cal.setTime(aDate);\n+ assertEquals(cal.get(Calendar.DAY_OF_YEAR), testResult);\n+ }\n }'" True,Regression,-1,commons-lang,80bd3fdb42a5d816ded9d9111c7dac3ce57c3101,66a37174a0398d76ff95904c22e77bc65890eec0,org.apache.commons.lang3.time.DateUtilsFragmentTest.testDaysOfYearWithCalendar,False,[],,,,"org.apache.commons.lang3.time.dateutils.getfragment(calendar,int,int)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\nindex dfd2e2741..de9d7c6f2 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\n@@ -561,4 +561,32 @@ testResult);\n / DateUtils.MILLIS_PER_HOUR,\n testResult);\n }\n+ \n+ @Test\n+ public void testDaysOfMonthWithCalendar() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.MONTH);\n+ assertEquals(days, testResult);\n+ }\n+ \n+ @Test\n+ public void testDaysOfMonthWithDate() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.MONTH);\n+ final Calendar cal = Calendar.getInstance();\n+ cal.setTime(aDate);\n+ assertEquals(cal.get(Calendar.DAY_OF_MONTH), testResult);\n+ } \n+ \n+ @Test\n+ public void testDaysOfYearWithCalendar() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.YEAR);\n+ assertEquals(aCalendar.get(Calendar.DAY_OF_YEAR), testResult);\n+ }\n+ \n+ @Test\n+ public void testDaysOfYearWithDate() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.YEAR);\n+ final Calendar cal = Calendar.getInstance();\n+ cal.setTime(aDate);\n+ assertEquals(cal.get(Calendar.DAY_OF_YEAR), testResult);\n+ }\n }'" True,Regression,-1,commons-lang,80bd3fdb42a5d816ded9d9111c7dac3ce57c3101,66a37174a0398d76ff95904c22e77bc65890eec0,org.apache.commons.lang3.time.DateUtilsFragmentTest.testDaysOfYearWithDate,False,[],,,,"org.apache.commons.lang3.time.dateutils.getfragment(calendar,int,int)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\nindex dfd2e2741..de9d7c6f2 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\n@@ -561,4 +561,32 @@ testResult);\n / DateUtils.MILLIS_PER_HOUR,\n testResult);\n }\n+ \n+ @Test\n+ public void testDaysOfMonthWithCalendar() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.MONTH);\n+ assertEquals(days, testResult);\n+ }\n+ \n+ @Test\n+ public void testDaysOfMonthWithDate() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.MONTH);\n+ final Calendar cal = Calendar.getInstance();\n+ cal.setTime(aDate);\n+ assertEquals(cal.get(Calendar.DAY_OF_MONTH), testResult);\n+ } \n+ \n+ @Test\n+ public void testDaysOfYearWithCalendar() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aCalendar, Calendar.YEAR);\n+ assertEquals(aCalendar.get(Calendar.DAY_OF_YEAR), testResult);\n+ }\n+ \n+ @Test\n+ public void testDaysOfYearWithDate() throws Exception {\n+ final long testResult = DateUtils.getFragmentInDays(aDate, Calendar.YEAR);\n+ final Calendar cal = Calendar.getInstance();\n+ cal.setTime(aDate);\n+ assertEquals(cal.get(Calendar.DAY_OF_YEAR), testResult);\n+ }\n }'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Regression,-1,commons-lang,9397608dd35a335d5e14813c0923f9419782980a,5a509030a946646780e963b9f492a4eaff734116,org.apache.commons.lang3.math.NumberUtilsTest.testLANG971,False,[],,,,org.apache.commons.lang3.math.numberutils.isnumber(string),"u'diff --git a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java\nindex d211b6c49..ea895e256 100644\n--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java\n@@ -1225,6 +1225,15 @@ public class NumberUtilsTest {\n compareIsNumberWithCreateNumber(""1.1L"", false); // LANG-664\n }\n \n+ @Test\n+ public void testLANG971() {\n+ compareIsNumberWithCreateNumber(""0085"", false);\n+ compareIsNumberWithCreateNumber(""085"", false);\n+ compareIsNumberWithCreateNumber(""08"", false);\n+ compareIsNumberWithCreateNumber(""07"", true);\n+ compareIsNumberWithCreateNumber(""00"", true);\n+ }\n+\n @Test\n public void testLANG972() {\n compareIsNumberWithCreateNumber(""0xABCD"", true);'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Regression,-1,commons-lang,5a509030a946646780e963b9f492a4eaff734116,159415855d06d186e86a70f3d4aba8c2e96d4b34,org.apache.commons.lang3.math.NumberUtilsTest.testLANG972,False,[],,,,org.apache.commons.lang3.math.numberutils.isnumber(string),"u'diff --git a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java\nindex 9b52ac6de..d211b6c49 100644\n--- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java\n@@ -1225,6 +1225,12 @@ public class NumberUtilsTest {\n compareIsNumberWithCreateNumber(""1.1L"", false); // LANG-664\n }\n \n+ @Test\n+ public void testLANG972() {\n+ compareIsNumberWithCreateNumber(""0xABCD"", true);\n+ compareIsNumberWithCreateNumber(""0XABCD"", true);\n+ }\n+\n private void compareIsNumberWithCreateNumber(final String val, final boolean expected) {\n final boolean isValid = NumberUtils.isNumber(val);\n final boolean canCreate = checkCreateNumber(val);'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Regression,-1,commons-lang,cf4138d7bc1a892295ccd58ea8b42f7c8737239a,ddc06197e4c9cdd009ba2a039dca77099797c584,org.apache.commons.lang3.time.DurationFormatUtilsTest.testLANG984,False,[],,,,"org.apache.commons.lang3.time.durationformatutils.formatduration(long,string,boolean)@org.apache.commons.lang3.time.durationformatutils.format(token[],int,int,int,int,int,int,int,boolean)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex d56ce725a..d144a0488 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -519,7 +519,17 @@ public class DurationFormatUtilsTest {\n new int[] { 1997, 1, 28, 0, 0, 0 }, ""M d""); \n \n }\n- \n+\n+ @Test\n+ public void testLANG984() { // Long durations\n+ assertEquals(""0"", DurationFormatUtils.formatDuration(0, ""S""));\n+ assertEquals(Integer.toString(Integer.MAX_VALUE), DurationFormatUtils.formatDuration(Integer.MAX_VALUE, ""S""));\n+ long maxIntPlus=Integer.MAX_VALUE;\n+ maxIntPlus++;\n+ assertEquals(Long.toString(maxIntPlus), DurationFormatUtils.formatDuration(maxIntPlus, ""S""));\n+ assertEquals(Long.toString(Long.MAX_VALUE), DurationFormatUtils.formatDuration(Long.MAX_VALUE, ""S""));\n+ }\n+\n @Test\n public void testDurationsByBruteForce() {\n bruteForce(2006, 0, 1, ""d"", Calendar.DAY_OF_MONTH);'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Delta,-1,commons-lang,77f5fe29e317c634bced62e54f6ead8a1c85c238,8b5e3eb81ddf3417f8f628c211507694ce2b92bb,org.apache.commons.lang3.time.DurationFormatUtilsTest.testLANG982,False,[],,,,"org.apache.commons.lang3.time.durationformatutils.format(token[],long,long,long,long,long,long,long,boolean)",u''
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Regression,-1,commons-lang,aadd8e172eb22fb593fbaa454075677656fad111,8d360ae70732ae26d961f76da5a98c44ac5931c6,org.apache.commons.lang3.time.DurationFormatUtilsTest.testLANG981,False,[],,,,org.apache.commons.lang3.time.durationformatutils.lexx(string),"u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex 07214486c..1311d904f 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -553,7 +553,12 @@ public class DurationFormatUtilsTest {\n bruteForce(1969, 1, 28, ""M"", Calendar.MONTH); // tests for 48 years\n //bruteForce(1996, 1, 29, ""M"", Calendar.MONTH); // this will fail\n }\n- \n+\n+ @Test(expected=IllegalArgumentException.class)\n+ public void testLANG981() { // unmatched quote char in lexx\n+ DurationFormatUtils.lexx(""\'yMdHms\'\'S"");\n+ }\n+\n private static final int FOUR_YEARS = 365 * 3 + 366;\n \n // Takes a minute to run, so generally turned off'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Regression,-1,commons-lang,0942ef04f1fa911d382b79a92dca1dd4b3eb88e6,8252b04a45722648ce2225853de9882b3b0de034,org.apache.commons.lang3.time.DateUtilsFragmentTest.testMinutesOfYearWithWrongOffsetBugWithCalendar,False,[],,,,"org.apache.commons.lang3.time.dateutils.getfragment(calendar,int,int)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\nindex ff9cf3369..227483a3d 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java\n@@ -531,6 +531,19 @@ testResult);\n testResult);\n }\n \n+ @Test\n+ public void testMinutesOfYearWithWrongOffsetBugWithCalendar() {\n+ Calendar c = Calendar.getInstance();\n+ c.set(Calendar.MONTH, Calendar.JANUARY);\n+ c.set(Calendar.DAY_OF_YEAR, 1);\n+ c.set(Calendar.HOUR_OF_DAY, 0);\n+ c.set(Calendar.MINUTE, 0);\n+ c.set(Calendar.SECOND, 0);\n+ c.set(Calendar.MILLISECOND, 0);\n+ final long testResult = DateUtils.getFragmentInMinutes(c, Calendar.YEAR);\n+ assertEquals( 0, testResult);\n+ }\n+\n @Test\n public void testHoursOfYearWithDate() {\n final long testResult = DateUtils.getFragmentInHours(aDate, Calendar.YEAR);'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Delta,-1,commons-lang,6ea7f2f7afcd6d60d62a5cd1392feda3471fc666,38f8b88528487efc4e53ac6c91f08fbaaa2a82d6,org.apache.commons.lang3.text.translate.OctalUnescaperTest.testBetween,False,[],,,,"org.apache.commons.lang3.text.translate.octalunescaper.translate(charsequence,int,writer)","u'diff --git a/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java b/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java\nindex 7cbe60ce3..0485a17c1 100644\n--- a/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java\n+++ b/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java\n@@ -44,15 +44,44 @@ public class OctalUnescaperTest {\n \n input = ""\\378 and"";\n result = oue.translate(input);\n- assertEquals(""Failed to unescape octal characters via the between method"", ""\378 and"", result);\n+ assertEquals(""Failed to unescape octal characters via the between method"", ""\37"" + ""8 and"", result);\n \n input = ""\\378"";\n result = oue.translate(input);\n- assertEquals(""Failed to unescape octal characters via the between method"", ""\378"", result);\n+ assertEquals(""Failed to unescape octal characters via the between method"", ""\37"" + ""8"", result);\n \n input = ""\\1"";\n result = oue.translate(input);\n assertEquals(""Failed to unescape octal characters via the between method"", ""\1"", result);\n+\n+ input = ""\\036"";\n+ result = oue.translate(input);\n+ assertEquals(""Failed to unescape octal characters via the between method"", ""\036"", result);\n+\n+ input = ""\\0365"";\n+ result = oue.translate(input);\n+ assertEquals(""Failed to unescape octal characters via the between method"", ""\036"" + ""5"", result);\n+\n+ input = ""\\003"";\n+ result = oue.translate(input);\n+ assertEquals(""Failed to unescape octal characters via the between method"", ""\003"", result);\n+\n+ input = ""\\0003"";\n+ result = oue.translate(input);\n+ assertEquals(""Failed to unescape octal characters via the between method"", ""\000"" + ""3"", result);\n+ }\n+\n+ @Test\n+ public void testOutOfRange() {\n+ final OctalUnescaper oue = new OctalUnescaper();\n+\n+ String input = ""\\999"";\n+ try {\n+ String result = oue.translate(input);\n+ fail(""NumberFormatException was expected for input: "" + input);\n+ } catch(NumberFormatException nfe) {\n+ // expected\n+ }\n }\n \n }'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Delta,-1,commons-lang,775203dd2cfce017910d04c58a0b1b4e0a64923c,bea1ae92aa52a985f8c171c6e17ff7fc4aa61fe4,org.apache.commons.lang3.time.FastDatePrinterTest.testLang538,False,[],,,,"org.apache.commons.lang3.time.fastdateprinter.format(calendar,stringbuffer)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\nindex 5a1d69fa0..425ec6c50 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n@@ -108,132 +108,75 @@ public class DateFormatUtilsTest {\n \n assertEquals (""2005-01-01T12:00:00"", DateFormatUtils.formatUTC(c.getTime().getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), Locale.US));\n }\n+\n+ private void assertFormats(String expectedValue, String pattern, TimeZone timeZone, Calendar cal) {\n+ assertEquals(expectedValue, DateFormatUtils.format(cal.getTime(), pattern, timeZone));\n+ assertEquals(expectedValue, DateFormatUtils.format(cal.getTime().getTime(), pattern, timeZone));\n+ assertEquals(expectedValue, DateFormatUtils.format(cal, pattern, timeZone));\n+ }\n+\n+ private Calendar createFebruaryTestDate(final TimeZone timeZone) {\n+ final Calendar cal = Calendar.getInstance(timeZone);\n+ cal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n+ return cal;\n+ }\n+\n+ private Calendar createJuneTestDate(final TimeZone timeZone) {\n+ final Calendar cal = Calendar.getInstance(timeZone);\n+ cal.set(2003, Calendar.JUNE, 8, 10, 11, 12);\n+ return cal;\n+ }\n+\n+ private void testGmtMinus3(String expectedValue, String pattern) {\n+ final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n+ assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));\n+ }\n+\n+ private void testUTC(String expectedValue, String pattern) {\n+ final TimeZone timeZone = TimeZone.getTimeZone(""UTC"");\n+ assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));\n+ }\n \n @Test\n public void testDateTimeISO() throws Exception {\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- text = DateFormatUtils.ISO_DATETIME_FORMAT.format(cal);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- \n- Calendar utcCal = Calendar.getInstance(TimeZone.getTimeZone(""UTC""));\n- utcCal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n- utcCal.set(Calendar.MILLISECOND, 0);\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(utcCal);\n- assertEquals(""2002-02-23T09:11:12Z"", text);\n- Date date = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(text);\n- assertEquals(utcCal.getTime(), date);\n+ testGmtMinus3(""2002-02-23T09:11:12"", DateFormatUtils.ISO_DATETIME_FORMAT.getPattern());\n+ testGmtMinus3(""2002-02-23T09:11:12-03:00"", DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""2002-02-23T09:11:12Z"", DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testDateISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23"", text);\n- text = DateFormatUtils.ISO_DATE_FORMAT.format(cal);\n- assertEquals(""2002-02-23"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23-03:00"", text);\n- text = DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""2002-02-23-03:00"", text);\n+ testGmtMinus3(""2002-02-23"", DateFormatUtils.ISO_DATE_FORMAT.getPattern());\n+ testGmtMinus3(""2002-02-23-03:00"", DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""2002-02-23Z"", DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testTimeISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12"", text);\n- text = DateFormatUtils.ISO_TIME_FORMAT.format(cal);\n- assertEquals(""T10:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""T10:11:12-03:00"", text);\n+ testGmtMinus3(""T09:11:12"", DateFormatUtils.ISO_TIME_FORMAT.getPattern());\n+ testGmtMinus3(""T09:11:12-03:00"", DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""T09:11:12Z"", DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testTimeNoTISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12"", text);\n- text = DateFormatUtils.ISO_TIME_NO_T_FORMAT.format(cal);\n- assertEquals(""10:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""10:11:12-03:00"", text);\n+ testGmtMinus3(""09:11:12"", DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern());\n+ testGmtMinus3(""09:11:12-03:00"", DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""09:11:12Z"", DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testSMTP(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2003, Calendar.JUNE, 8, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), timeZone,\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), timeZone,\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n- text = DateFormatUtils.SMTP_DATETIME_FORMAT.format(cal);\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n+ TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n+ Calendar june = createJuneTestDate(timeZone);\n \n- // format UTC\n- text = DateFormatUtils.formatUTC(cal.getTime().getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 13:11:12 +0000"", text);\n+ assertFormats(""Sun, 08 Jun 2003 10:11:12 -0300"", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n+ timeZone, june);\n+\n+ timeZone = TimeZone.getTimeZone(""UTC"");\n+ june = createJuneTestDate(timeZone);\n+ assertFormats(""Sun, 08 Jun 2003 10:11:12 +0000"", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n+ timeZone, june);\n }\n \n /*\n@@ -285,4 +228,46 @@ public class DateFormatUtilsTest {\n TimeZone.setDefault(save);\n }\n }\n+\n+ /*\n+ According to LANG-916 (https://issues.apache.org/jira/browse/LANG-916),\n+ the format method did contain a bug: it did not use the TimeZone data.\n+ \n+ This method test that the bug is fixed.\n+ /\n+ @Test\n+ public void testLang916() throws Exception {\n+\n+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(""Europe/Paris""));\n+ cal.clear();\n+ cal.set(2009, 9, 16, 8, 42, 16);\n+\n+ // Long.\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/Paris""));\n+ assertEquals(""long"", ""2009-10-16T08:42:16+02:00"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Asia/Kolkata""));\n+ assertEquals(""long"", ""2009-10-16T12:12:16+05:30"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/London""));\n+ assertEquals(""long"", ""2009-10-16T07:42:16+01:00"", value);\n+ }\n+\n+ // Calendar.\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/Paris""));\n+ assertEquals(""calendar"", ""2009-10-16T08:42:16+02:00"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Asia/Kolkata""));\n+ assertEquals(""calendar"", ""2009-10-16T12:12:16+05:30"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/London""));\n+ assertEquals(""calendar"", ""2009-10-16T07:42:16+01:00"", value);\n+ }\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex 15456428a..6941f42f2 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -266,7 +266,7 @@ public class DurationFormatUtilsTest {\n cal.set(Calendar.MILLISECOND, 1);\n String text;\n // repeat a test from testDateTimeISO to compare extended and not extended.\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n+ text = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n assertEquals(""2002-02-23T09:11:12-03:00"", text);\n // test fixture is the same as above, but now with extended format.\n text = DurationFormatUtils.formatPeriod(base.getTime().getTime(), cal.getTime().getTime(),\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\nindex f8b4930dc..5aaa67024 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n@@ -214,7 +214,7 @@ public class FastDatePrinterTest {\n \n final DatePrinter format = getInstance(""yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\'"", TimeZone.getTimeZone(""GMT""));\n assertEquals(""dateTime"", ""2009-10-16T16:42:16.000Z"", format.format(cal.getTime()));\n- assertEquals(""dateTime"", ""2009-10-16T08:42:16.000Z"", format.format(cal));\n+ assertEquals(""dateTime"", ""2009-10-16T16:42:16.000Z"", format.format(cal));\n }\n \n @Test\n@@ -339,4 +339,32 @@ public class FastDatePrinterTest {\n assertEquals(""0002"", getInstance(""dddd"", SWEDEN).format(cal));\n assertEquals(""00002"", getInstance(""ddddd"", SWEDEN).format(cal));\n }\n+\n+ /\n+ According to LANG-916 (https://issues.apache.org/jira/browse/LANG-916),\n+ the format method did contain a bug: it did not use the TimeZone data.\n+ \n+ This method test that the bug is fixed.\n+ */\n+ @Test\n+ public void testLang916() throws Exception {\n+\n+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(""Europe/Paris""));\n+ cal.clear();\n+ cal.set(2009, 9, 16, 8, 42, 16);\n+\n+ // calendar fast.\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Europe/Paris"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T08:42:16 +0200"", value);\n+ }\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Asia/Kolkata"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T12:12:16 +0530"", value);\n+ }\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Europe/London"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T07:42:16 +0100"", value);\n+ }\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\nindex 34ff2f516..3ae5f5625 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\n@@ -57,7 +57,7 @@ public class FastDatePrinterTimeZonesTest {\n final SimpleDateFormat sdf = new SimpleDateFormat(PATTERN);\n sdf.setTimeZone(timeZone);\n final String expectedValue = sdf.format(cal.getTime());\n- final String actualValue = FastDateFormat.getInstance(PATTERN).format(cal);\n+ final String actualValue = FastDateFormat.getInstance(PATTERN, this.timeZone).format(cal);\n assertEquals(expectedValue, actualValue);\n }\n '" True,Delta,-1,commons-lang,775203dd2cfce017910d04c58a0b1b4e0a64923c,bea1ae92aa52a985f8c171c6e17ff7fc4aa61fe4,org.apache.commons.lang3.time.FastDateFormatTest.testParseSync,False,[],,,,"org.apache.commons.lang3.time.fastdateprinter.format(calendar,stringbuffer)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\nindex 5a1d69fa0..425ec6c50 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n@@ -108,132 +108,75 @@ public class DateFormatUtilsTest {\n \n assertEquals (""2005-01-01T12:00:00"", DateFormatUtils.formatUTC(c.getTime().getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), Locale.US));\n }\n+\n+ private void assertFormats(String expectedValue, String pattern, TimeZone timeZone, Calendar cal) {\n+ assertEquals(expectedValue, DateFormatUtils.format(cal.getTime(), pattern, timeZone));\n+ assertEquals(expectedValue, DateFormatUtils.format(cal.getTime().getTime(), pattern, timeZone));\n+ assertEquals(expectedValue, DateFormatUtils.format(cal, pattern, timeZone));\n+ }\n+\n+ private Calendar createFebruaryTestDate(final TimeZone timeZone) {\n+ final Calendar cal = Calendar.getInstance(timeZone);\n+ cal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n+ return cal;\n+ }\n+\n+ private Calendar createJuneTestDate(final TimeZone timeZone) {\n+ final Calendar cal = Calendar.getInstance(timeZone);\n+ cal.set(2003, Calendar.JUNE, 8, 10, 11, 12);\n+ return cal;\n+ }\n+\n+ private void testGmtMinus3(String expectedValue, String pattern) {\n+ final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n+ assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));\n+ }\n+\n+ private void testUTC(String expectedValue, String pattern) {\n+ final TimeZone timeZone = TimeZone.getTimeZone(""UTC"");\n+ assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));\n+ }\n \n @Test\n public void testDateTimeISO() throws Exception {\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- text = DateFormatUtils.ISO_DATETIME_FORMAT.format(cal);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- \n- Calendar utcCal = Calendar.getInstance(TimeZone.getTimeZone(""UTC""));\n- utcCal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n- utcCal.set(Calendar.MILLISECOND, 0);\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(utcCal);\n- assertEquals(""2002-02-23T09:11:12Z"", text);\n- Date date = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(text);\n- assertEquals(utcCal.getTime(), date);\n+ testGmtMinus3(""2002-02-23T09:11:12"", DateFormatUtils.ISO_DATETIME_FORMAT.getPattern());\n+ testGmtMinus3(""2002-02-23T09:11:12-03:00"", DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""2002-02-23T09:11:12Z"", DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testDateISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23"", text);\n- text = DateFormatUtils.ISO_DATE_FORMAT.format(cal);\n- assertEquals(""2002-02-23"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23-03:00"", text);\n- text = DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""2002-02-23-03:00"", text);\n+ testGmtMinus3(""2002-02-23"", DateFormatUtils.ISO_DATE_FORMAT.getPattern());\n+ testGmtMinus3(""2002-02-23-03:00"", DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""2002-02-23Z"", DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testTimeISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12"", text);\n- text = DateFormatUtils.ISO_TIME_FORMAT.format(cal);\n- assertEquals(""T10:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""T10:11:12-03:00"", text);\n+ testGmtMinus3(""T09:11:12"", DateFormatUtils.ISO_TIME_FORMAT.getPattern());\n+ testGmtMinus3(""T09:11:12-03:00"", DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""T09:11:12Z"", DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testTimeNoTISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12"", text);\n- text = DateFormatUtils.ISO_TIME_NO_T_FORMAT.format(cal);\n- assertEquals(""10:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""10:11:12-03:00"", text);\n+ testGmtMinus3(""09:11:12"", DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern());\n+ testGmtMinus3(""09:11:12-03:00"", DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""09:11:12Z"", DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testSMTP(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2003, Calendar.JUNE, 8, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), timeZone,\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), timeZone,\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n- text = DateFormatUtils.SMTP_DATETIME_FORMAT.format(cal);\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n+ TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n+ Calendar june = createJuneTestDate(timeZone);\n \n- // format UTC\n- text = DateFormatUtils.formatUTC(cal.getTime().getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 13:11:12 +0000"", text);\n+ assertFormats(""Sun, 08 Jun 2003 10:11:12 -0300"", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n+ timeZone, june);\n+\n+ timeZone = TimeZone.getTimeZone(""UTC"");\n+ june = createJuneTestDate(timeZone);\n+ assertFormats(""Sun, 08 Jun 2003 10:11:12 +0000"", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n+ timeZone, june);\n }\n \n /*\n@@ -285,4 +228,46 @@ public class DateFormatUtilsTest {\n TimeZone.setDefault(save);\n }\n }\n+\n+ /\n+ According to LANG-916 (https://issues.apache.org/jira/browse/LANG-916),\n+ the format method did contain a bug: it did not use the TimeZone data.\n+ \n+ This method test that the bug is fixed.\n+ */\n+ @Test\n+ public void testLang916() throws Exception {\n+\n+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(""Europe/Paris""));\n+ cal.clear();\n+ cal.set(2009, 9, 16, 8, 42, 16);\n+\n+ // Long.\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/Paris""));\n+ assertEquals(""long"", ""2009-10-16T08:42:16+02:00"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Asia/Kolkata""));\n+ assertEquals(""long"", ""2009-10-16T12:12:16+05:30"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/London""));\n+ assertEquals(""long"", ""2009-10-16T07:42:16+01:00"", value);\n+ }\n+\n+ // Calendar.\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/Paris""));\n+ assertEquals(""calendar"", ""2009-10-16T08:42:16+02:00"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Asia/Kolkata""));\n+ assertEquals(""calendar"", ""2009-10-16T12:12:16+05:30"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/London""));\n+ assertEquals(""calendar"", ""2009-10-16T07:42:16+01:00"", value);\n+ }\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex 15456428a..6941f42f2 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -266,7 +266,7 @@ public class DurationFormatUtilsTest {\n cal.set(Calendar.MILLISECOND, 1);\n String text;\n // repeat a test from testDateTimeISO to compare extended and not extended.\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n+ text = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n assertEquals(""2002-02-23T09:11:12-03:00"", text);\n // test fixture is the same as above, but now with extended format.\n text = DurationFormatUtils.formatPeriod(base.getTime().getTime(), cal.getTime().getTime(),\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\nindex f8b4930dc..5aaa67024 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n@@ -214,7 +214,7 @@ public class FastDatePrinterTest {\n \n final DatePrinter format = getInstance(""yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\'"", TimeZone.getTimeZone(""GMT""));\n assertEquals(""dateTime"", ""2009-10-16T16:42:16.000Z"", format.format(cal.getTime()));\n- assertEquals(""dateTime"", ""2009-10-16T08:42:16.000Z"", format.format(cal));\n+ assertEquals(""dateTime"", ""2009-10-16T16:42:16.000Z"", format.format(cal));\n }\n \n @Test\n@@ -339,4 +339,32 @@ public class FastDatePrinterTest {\n assertEquals(""0002"", getInstance(""dddd"", SWEDEN).format(cal));\n assertEquals(""00002"", getInstance(""ddddd"", SWEDEN).format(cal));\n }\n+\n+ /\n+ According to LANG-916 (https://issues.apache.org/jira/browse/LANG-916),\n+ the format method did contain a bug: it did not use the TimeZone data.\n+ \n+ This method test that the bug is fixed.\n+ */\n+ @Test\n+ public void testLang916() throws Exception {\n+\n+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(""Europe/Paris""));\n+ cal.clear();\n+ cal.set(2009, 9, 16, 8, 42, 16);\n+\n+ // calendar fast.\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Europe/Paris"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T08:42:16 +0200"", value);\n+ }\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Asia/Kolkata"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T12:12:16 +0530"", value);\n+ }\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Europe/London"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T07:42:16 +0100"", value);\n+ }\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\nindex 34ff2f516..3ae5f5625 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\n@@ -57,7 +57,7 @@ public class FastDatePrinterTimeZonesTest {\n final SimpleDateFormat sdf = new SimpleDateFormat(PATTERN);\n sdf.setTimeZone(timeZone);\n final String expectedValue = sdf.format(cal.getTime());\n- final String actualValue = FastDateFormat.getInstance(PATTERN).format(cal);\n+ final String actualValue = FastDateFormat.getInstance(PATTERN, this.timeZone).format(cal);\n assertEquals(expectedValue, actualValue);\n }\n '" True,Regression,-1,commons-lang,775203dd2cfce017910d04c58a0b1b4e0a64923c,bea1ae92aa52a985f8c171c6e17ff7fc4aa61fe4,org.apache.commons.lang3.time.FastDatePrinterTest.testLang916,False,[],,,,"org.apache.commons.lang3.time.fastdateprinter.format(calendar,stringbuffer)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\nindex 5a1d69fa0..425ec6c50 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n@@ -108,132 +108,75 @@ public class DateFormatUtilsTest {\n \n assertEquals (""2005-01-01T12:00:00"", DateFormatUtils.formatUTC(c.getTime().getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), Locale.US));\n }\n+\n+ private void assertFormats(String expectedValue, String pattern, TimeZone timeZone, Calendar cal) {\n+ assertEquals(expectedValue, DateFormatUtils.format(cal.getTime(), pattern, timeZone));\n+ assertEquals(expectedValue, DateFormatUtils.format(cal.getTime().getTime(), pattern, timeZone));\n+ assertEquals(expectedValue, DateFormatUtils.format(cal, pattern, timeZone));\n+ }\n+\n+ private Calendar createFebruaryTestDate(final TimeZone timeZone) {\n+ final Calendar cal = Calendar.getInstance(timeZone);\n+ cal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n+ return cal;\n+ }\n+\n+ private Calendar createJuneTestDate(final TimeZone timeZone) {\n+ final Calendar cal = Calendar.getInstance(timeZone);\n+ cal.set(2003, Calendar.JUNE, 8, 10, 11, 12);\n+ return cal;\n+ }\n+\n+ private void testGmtMinus3(String expectedValue, String pattern) {\n+ final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n+ assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));\n+ }\n+\n+ private void testUTC(String expectedValue, String pattern) {\n+ final TimeZone timeZone = TimeZone.getTimeZone(""UTC"");\n+ assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));\n+ }\n \n @Test\n public void testDateTimeISO() throws Exception {\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- text = DateFormatUtils.ISO_DATETIME_FORMAT.format(cal);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- \n- Calendar utcCal = Calendar.getInstance(TimeZone.getTimeZone(""UTC""));\n- utcCal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n- utcCal.set(Calendar.MILLISECOND, 0);\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(utcCal);\n- assertEquals(""2002-02-23T09:11:12Z"", text);\n- Date date = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(text);\n- assertEquals(utcCal.getTime(), date);\n+ testGmtMinus3(""2002-02-23T09:11:12"", DateFormatUtils.ISO_DATETIME_FORMAT.getPattern());\n+ testGmtMinus3(""2002-02-23T09:11:12-03:00"", DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""2002-02-23T09:11:12Z"", DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testDateISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23"", text);\n- text = DateFormatUtils.ISO_DATE_FORMAT.format(cal);\n- assertEquals(""2002-02-23"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23-03:00"", text);\n- text = DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""2002-02-23-03:00"", text);\n+ testGmtMinus3(""2002-02-23"", DateFormatUtils.ISO_DATE_FORMAT.getPattern());\n+ testGmtMinus3(""2002-02-23-03:00"", DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""2002-02-23Z"", DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testTimeISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12"", text);\n- text = DateFormatUtils.ISO_TIME_FORMAT.format(cal);\n- assertEquals(""T10:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""T10:11:12-03:00"", text);\n+ testGmtMinus3(""T09:11:12"", DateFormatUtils.ISO_TIME_FORMAT.getPattern());\n+ testGmtMinus3(""T09:11:12-03:00"", DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""T09:11:12Z"", DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testTimeNoTISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12"", text);\n- text = DateFormatUtils.ISO_TIME_NO_T_FORMAT.format(cal);\n- assertEquals(""10:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""10:11:12-03:00"", text);\n+ testGmtMinus3(""09:11:12"", DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern());\n+ testGmtMinus3(""09:11:12-03:00"", DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""09:11:12Z"", DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testSMTP(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2003, Calendar.JUNE, 8, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), timeZone,\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), timeZone,\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n- text = DateFormatUtils.SMTP_DATETIME_FORMAT.format(cal);\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n+ TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n+ Calendar june = createJuneTestDate(timeZone);\n \n- // format UTC\n- text = DateFormatUtils.formatUTC(cal.getTime().getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 13:11:12 +0000"", text);\n+ assertFormats(""Sun, 08 Jun 2003 10:11:12 -0300"", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n+ timeZone, june);\n+\n+ timeZone = TimeZone.getTimeZone(""UTC"");\n+ june = createJuneTestDate(timeZone);\n+ assertFormats(""Sun, 08 Jun 2003 10:11:12 +0000"", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n+ timeZone, june);\n }\n \n /*\n@@ -285,4 +228,46 @@ public class DateFormatUtilsTest {\n TimeZone.setDefault(save);\n }\n }\n+\n+ /\n+ According to LANG-916 (https://issues.apache.org/jira/browse/LANG-916),\n+ the format method did contain a bug: it did not use the TimeZone data.\n+ \n+ This method test that the bug is fixed.\n+ */\n+ @Test\n+ public void testLang916() throws Exception {\n+\n+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(""Europe/Paris""));\n+ cal.clear();\n+ cal.set(2009, 9, 16, 8, 42, 16);\n+\n+ // Long.\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/Paris""));\n+ assertEquals(""long"", ""2009-10-16T08:42:16+02:00"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Asia/Kolkata""));\n+ assertEquals(""long"", ""2009-10-16T12:12:16+05:30"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/London""));\n+ assertEquals(""long"", ""2009-10-16T07:42:16+01:00"", value);\n+ }\n+\n+ // Calendar.\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/Paris""));\n+ assertEquals(""calendar"", ""2009-10-16T08:42:16+02:00"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Asia/Kolkata""));\n+ assertEquals(""calendar"", ""2009-10-16T12:12:16+05:30"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/London""));\n+ assertEquals(""calendar"", ""2009-10-16T07:42:16+01:00"", value);\n+ }\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex 15456428a..6941f42f2 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -266,7 +266,7 @@ public class DurationFormatUtilsTest {\n cal.set(Calendar.MILLISECOND, 1);\n String text;\n // repeat a test from testDateTimeISO to compare extended and not extended.\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n+ text = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n assertEquals(""2002-02-23T09:11:12-03:00"", text);\n // test fixture is the same as above, but now with extended format.\n text = DurationFormatUtils.formatPeriod(base.getTime().getTime(), cal.getTime().getTime(),\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\nindex f8b4930dc..5aaa67024 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n@@ -214,7 +214,7 @@ public class FastDatePrinterTest {\n \n final DatePrinter format = getInstance(""yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\'"", TimeZone.getTimeZone(""GMT""));\n assertEquals(""dateTime"", ""2009-10-16T16:42:16.000Z"", format.format(cal.getTime()));\n- assertEquals(""dateTime"", ""2009-10-16T08:42:16.000Z"", format.format(cal));\n+ assertEquals(""dateTime"", ""2009-10-16T16:42:16.000Z"", format.format(cal));\n }\n \n @Test\n@@ -339,4 +339,32 @@ public class FastDatePrinterTest {\n assertEquals(""0002"", getInstance(""dddd"", SWEDEN).format(cal));\n assertEquals(""00002"", getInstance(""ddddd"", SWEDEN).format(cal));\n }\n+\n+ /\n+ According to LANG-916 (https://issues.apache.org/jira/browse/LANG-916),\n+ the format method did contain a bug: it did not use the TimeZone data.\n+ \n+ This method test that the bug is fixed.\n+ */\n+ @Test\n+ public void testLang916() throws Exception {\n+\n+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(""Europe/Paris""));\n+ cal.clear();\n+ cal.set(2009, 9, 16, 8, 42, 16);\n+\n+ // calendar fast.\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Europe/Paris"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T08:42:16 +0200"", value);\n+ }\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Asia/Kolkata"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T12:12:16 +0530"", value);\n+ }\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Europe/London"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T07:42:16 +0100"", value);\n+ }\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\nindex 34ff2f516..3ae5f5625 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\n@@ -57,7 +57,7 @@ public class FastDatePrinterTimeZonesTest {\n final SimpleDateFormat sdf = new SimpleDateFormat(PATTERN);\n sdf.setTimeZone(timeZone);\n final String expectedValue = sdf.format(cal.getTime());\n- final String actualValue = FastDateFormat.getInstance(PATTERN).format(cal);\n+ final String actualValue = FastDateFormat.getInstance(PATTERN, this.timeZone).format(cal);\n assertEquals(expectedValue, actualValue);\n }\n '" True,Regression,-1,commons-lang,775203dd2cfce017910d04c58a0b1b4e0a64923c,bea1ae92aa52a985f8c171c6e17ff7fc4aa61fe4,org.apache.commons.lang3.time.DateFormatUtilsTest.testLang916,False,[],,,,"org.apache.commons.lang3.time.fastdateprinter.format(calendar,stringbuffer)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\nindex 5a1d69fa0..425ec6c50 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java\n@@ -108,132 +108,75 @@ public class DateFormatUtilsTest {\n \n assertEquals (""2005-01-01T12:00:00"", DateFormatUtils.formatUTC(c.getTime().getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), Locale.US));\n }\n+\n+ private void assertFormats(String expectedValue, String pattern, TimeZone timeZone, Calendar cal) {\n+ assertEquals(expectedValue, DateFormatUtils.format(cal.getTime(), pattern, timeZone));\n+ assertEquals(expectedValue, DateFormatUtils.format(cal.getTime().getTime(), pattern, timeZone));\n+ assertEquals(expectedValue, DateFormatUtils.format(cal, pattern, timeZone));\n+ }\n+\n+ private Calendar createFebruaryTestDate(final TimeZone timeZone) {\n+ final Calendar cal = Calendar.getInstance(timeZone);\n+ cal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n+ return cal;\n+ }\n+\n+ private Calendar createJuneTestDate(final TimeZone timeZone) {\n+ final Calendar cal = Calendar.getInstance(timeZone);\n+ cal.set(2003, Calendar.JUNE, 8, 10, 11, 12);\n+ return cal;\n+ }\n+\n+ private void testGmtMinus3(String expectedValue, String pattern) {\n+ final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n+ assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));\n+ }\n+\n+ private void testUTC(String expectedValue, String pattern) {\n+ final TimeZone timeZone = TimeZone.getTimeZone(""UTC"");\n+ assertFormats(expectedValue, pattern, timeZone, createFebruaryTestDate(timeZone));\n+ }\n \n @Test\n public void testDateTimeISO() throws Exception {\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- text = DateFormatUtils.ISO_DATETIME_FORMAT.format(cal);\n- assertEquals(""2002-02-23T09:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""2002-02-23T09:11:12-03:00"", text);\n- \n- Calendar utcCal = Calendar.getInstance(TimeZone.getTimeZone(""UTC""));\n- utcCal.set(2002, Calendar.FEBRUARY, 23, 9, 11, 12);\n- utcCal.set(Calendar.MILLISECOND, 0);\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(utcCal);\n- assertEquals(""2002-02-23T09:11:12Z"", text);\n- Date date = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.parse(text);\n- assertEquals(utcCal.getTime(), date);\n+ testGmtMinus3(""2002-02-23T09:11:12"", DateFormatUtils.ISO_DATETIME_FORMAT.getPattern());\n+ testGmtMinus3(""2002-02-23T09:11:12-03:00"", DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""2002-02-23T09:11:12Z"", DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testDateISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23"", text);\n- text = DateFormatUtils.ISO_DATE_FORMAT.format(cal);\n- assertEquals(""2002-02-23"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""2002-02-23-03:00"", text);\n- text = DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""2002-02-23-03:00"", text);\n+ testGmtMinus3(""2002-02-23"", DateFormatUtils.ISO_DATE_FORMAT.getPattern());\n+ testGmtMinus3(""2002-02-23-03:00"", DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""2002-02-23Z"", DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testTimeISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12"", text);\n- text = DateFormatUtils.ISO_TIME_FORMAT.format(cal);\n- assertEquals(""T10:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""T10:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""T10:11:12-03:00"", text);\n+ testGmtMinus3(""T09:11:12"", DateFormatUtils.ISO_TIME_FORMAT.getPattern());\n+ testGmtMinus3(""T09:11:12-03:00"", DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""T09:11:12Z"", DateFormatUtils.ISO_TIME_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testTimeNoTISO(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2002, Calendar.FEBRUARY, 23, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12"", text);\n- text = DateFormatUtils.ISO_TIME_NO_T_FORMAT.format(cal);\n- assertEquals(""10:11:12"", text);\n- \n- text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12-03:00"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern(), timeZone);\n- assertEquals(""10:11:12-03:00"", text);\n- text = DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.format(cal);\n- assertEquals(""10:11:12-03:00"", text);\n+ testGmtMinus3(""09:11:12"", DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern());\n+ testGmtMinus3(""09:11:12-03:00"", DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern());\n+ testUTC(""09:11:12Z"", DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern());\n }\n \n @Test\n public void testSMTP(){\n- final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n- final Calendar cal = Calendar.getInstance(timeZone);\n- cal.set(2003, Calendar.JUNE, 8, 10, 11, 12);\n- String text = DateFormatUtils.format(cal.getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), timeZone,\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n- text = DateFormatUtils.format(cal.getTime().getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), timeZone,\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n- text = DateFormatUtils.SMTP_DATETIME_FORMAT.format(cal);\n- assertEquals(""Sun, 08 Jun 2003 10:11:12 -0300"", text);\n+ TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n+ Calendar june = createJuneTestDate(timeZone);\n \n- // format UTC\n- text = DateFormatUtils.formatUTC(cal.getTime().getTime(), \n- DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n- DateFormatUtils.SMTP_DATETIME_FORMAT.getLocale());\n- assertEquals(""Sun, 08 Jun 2003 13:11:12 +0000"", text);\n+ assertFormats(""Sun, 08 Jun 2003 10:11:12 -0300"", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n+ timeZone, june);\n+\n+ timeZone = TimeZone.getTimeZone(""UTC"");\n+ june = createJuneTestDate(timeZone);\n+ assertFormats(""Sun, 08 Jun 2003 10:11:12 +0000"", DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(),\n+ timeZone, june);\n }\n \n /*\n@@ -285,4 +228,46 @@ public class DateFormatUtilsTest {\n TimeZone.setDefault(save);\n }\n }\n+\n+ /\n+ According to LANG-916 (https://issues.apache.org/jira/browse/LANG-916),\n+ the format method did contain a bug: it did not use the TimeZone data.\n+ \n+ This method test that the bug is fixed.\n+ */\n+ @Test\n+ public void testLang916() throws Exception {\n+\n+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(""Europe/Paris""));\n+ cal.clear();\n+ cal.set(2009, 9, 16, 8, 42, 16);\n+\n+ // Long.\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/Paris""));\n+ assertEquals(""long"", ""2009-10-16T08:42:16+02:00"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Asia/Kolkata""));\n+ assertEquals(""long"", ""2009-10-16T12:12:16+05:30"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal.getTimeInMillis(), DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/London""));\n+ assertEquals(""long"", ""2009-10-16T07:42:16+01:00"", value);\n+ }\n+\n+ // Calendar.\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/Paris""));\n+ assertEquals(""calendar"", ""2009-10-16T08:42:16+02:00"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Asia/Kolkata""));\n+ assertEquals(""calendar"", ""2009-10-16T12:12:16+05:30"", value);\n+ }\n+ {\n+ String value = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), TimeZone.getTimeZone(""Europe/London""));\n+ assertEquals(""calendar"", ""2009-10-16T07:42:16+01:00"", value);\n+ }\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex 15456428a..6941f42f2 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -266,7 +266,7 @@ public class DurationFormatUtilsTest {\n cal.set(Calendar.MILLISECOND, 1);\n String text;\n // repeat a test from testDateTimeISO to compare extended and not extended.\n- text = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cal);\n+ text = DateFormatUtils.format(cal, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), timeZone);\n assertEquals(""2002-02-23T09:11:12-03:00"", text);\n // test fixture is the same as above, but now with extended format.\n text = DurationFormatUtils.formatPeriod(base.getTime().getTime(), cal.getTime().getTime(),\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\nindex f8b4930dc..5aaa67024 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java\n@@ -214,7 +214,7 @@ public class FastDatePrinterTest {\n \n final DatePrinter format = getInstance(""yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\'"", TimeZone.getTimeZone(""GMT""));\n assertEquals(""dateTime"", ""2009-10-16T16:42:16.000Z"", format.format(cal.getTime()));\n- assertEquals(""dateTime"", ""2009-10-16T08:42:16.000Z"", format.format(cal));\n+ assertEquals(""dateTime"", ""2009-10-16T16:42:16.000Z"", format.format(cal));\n }\n \n @Test\n@@ -339,4 +339,32 @@ public class FastDatePrinterTest {\n assertEquals(""0002"", getInstance(""dddd"", SWEDEN).format(cal));\n assertEquals(""00002"", getInstance(""ddddd"", SWEDEN).format(cal));\n }\n+\n+ /*\n+ According to LANG-916 (https://issues.apache.org/jira/browse/LANG-916),\n+ the format method did contain a bug: it did not use the TimeZone data.\n+ \n+ This method test that the bug is fixed.\n+ /\n+ @Test\n+ public void testLang916() throws Exception {\n+\n+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(""Europe/Paris""));\n+ cal.clear();\n+ cal.set(2009, 9, 16, 8, 42, 16);\n+\n+ // calendar fast.\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Europe/Paris"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T08:42:16 +0200"", value);\n+ }\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Asia/Kolkata"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T12:12:16 +0530"", value);\n+ }\n+ {\n+ String value = FastDateFormat.getInstance(""yyyy-MM-dd\'T\'HH:mm:ss Z"", TimeZone.getTimeZone(""Europe/London"")).format(cal);\n+ assertEquals(""calendar"", ""2009-10-16T07:42:16 +0100"", value);\n+ }\n+ }\n }\ndiff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\nindex 34ff2f516..3ae5f5625 100644\n--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTimeZonesTest.java\n@@ -57,7 +57,7 @@ public class FastDatePrinterTimeZonesTest {\n final SimpleDateFormat sdf = new SimpleDateFormat(PATTERN);\n sdf.setTimeZone(timeZone);\n final String expectedValue = sdf.format(cal.getTime());\n- final String actualValue = FastDateFormat.getInstance(PATTERN).format(cal);\n+ final String actualValue = FastDateFormat.getInstance(PATTERN, this.timeZone).format(cal);\n assertEquals(expectedValue, actualValue);\n }\n '"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Delta,-1,commons-lang,fd54d42f78ae17a96fc005d2fcd080807343aad7,00dc479f6a1d204d557f4cb1d981ba236fe09565,org.apache.commons.lang3.time.StopWatchTest.testStopWatchSimpleGet,False,[],,,,org.apache.commons.lang3.time.durationformatutils.formatdurationhms(long),"u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex 21e11dc65..8f92d52c4 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -165,31 +165,31 @@ public class DurationFormatUtilsTest {\n @Test\n public void testFormatDurationHMS() {\n long time = 0;\n- assertEquals(""0:00:00.000"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.000"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 1;\n- assertEquals(""0:00:00.001"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.001"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 15;\n- assertEquals(""0:00:00.015"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.015"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 165;\n- assertEquals(""0:00:00.165"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.165"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 1675;\n- assertEquals(""0:00:01.675"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:01.675"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 13465;\n- assertEquals(""0:00:13.465"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:13.465"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 72789;\n- assertEquals(""0:01:12.789"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:01:12.789"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 12789 + 32 60000;\n- assertEquals(""0:32:12.789"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:32:12.789"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 12789 + 62 60000;\n- assertEquals(""1:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""01:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n }\n \n @Test(expected = IllegalArgumentException.class)\n@@ -367,13 +367,13 @@ public class DurationFormatUtilsTest {\n \n // tests the ISO 8601-like\n assertArrayEquals(new DurationFormatUtils.Token[]{\n- new DurationFormatUtils.Token(DurationFormatUtils.H, 1),\n+ new DurationFormatUtils.Token(DurationFormatUtils.H, 2),\n new DurationFormatUtils.Token(new StringBuilder("":""), 1),\n new DurationFormatUtils.Token(DurationFormatUtils.m, 2),\n new DurationFormatUtils.Token(new StringBuilder("":""), 1),\n new DurationFormatUtils.Token(DurationFormatUtils.s, 2),\n new DurationFormatUtils.Token(new StringBuilder("".""), 1),\n- new DurationFormatUtils.Token(DurationFormatUtils.S, 3)}, DurationFormatUtils.lexx(""H:mm:ss.SSS""));\n+ new DurationFormatUtils.Token(DurationFormatUtils.S, 3)}, DurationFormatUtils.lexx(""HH:mm:ss.SSS""));\n \n // test the iso extended format\n assertArrayEquals(new DurationFormatUtils.Token[]{\ndiff --git a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java\nindex f0404edfd..3e464cb66 100644\n--- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java\n@@ -52,7 +52,7 @@ public class StopWatchTest {\n public void testStopWatchSimpleGet(){\n final StopWatch watch = new StopWatch();\n assertEquals(0, watch.getTime());\n- assertEquals(""0:00:00.000"", watch.toString());\n+ assertEquals(""00:00:00.000"", watch.toString());\n \n watch.start();\n try {Thread.sleep(500);} catch (final InterruptedException ex) {}\n@@ -74,7 +74,7 @@ public class StopWatchTest {\n final long totalTime = watch.getTime();\n \n assertEquals(""Formatted split string not the correct length"", \n- splitStr.length(), 11);\n+ splitStr.length(), 12);\n assertTrue(splitTime >= 500);\n assertTrue(splitTime < 700);\n assertTrue(totalTime >= 1500);'" True,Delta,-1,commons-lang,fd54d42f78ae17a96fc005d2fcd080807343aad7,00dc479f6a1d204d557f4cb1d981ba236fe09565,org.apache.commons.lang3.time.StopWatchTest.testStopWatchSplit,False,[],,,,org.apache.commons.lang3.time.durationformatutils.formatdurationhms(long),"u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex 21e11dc65..8f92d52c4 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -165,31 +165,31 @@ public class DurationFormatUtilsTest {\n @Test\n public void testFormatDurationHMS() {\n long time = 0;\n- assertEquals(""0:00:00.000"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.000"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 1;\n- assertEquals(""0:00:00.001"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.001"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 15;\n- assertEquals(""0:00:00.015"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.015"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 165;\n- assertEquals(""0:00:00.165"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.165"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 1675;\n- assertEquals(""0:00:01.675"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:01.675"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 13465;\n- assertEquals(""0:00:13.465"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:13.465"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 72789;\n- assertEquals(""0:01:12.789"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:01:12.789"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 12789 + 32 60000;\n- assertEquals(""0:32:12.789"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:32:12.789"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 12789 + 62 60000;\n- assertEquals(""1:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""01:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n }\n \n @Test(expected = IllegalArgumentException.class)\n@@ -367,13 +367,13 @@ public class DurationFormatUtilsTest {\n \n // tests the ISO 8601-like\n assertArrayEquals(new DurationFormatUtils.Token[]{\n- new DurationFormatUtils.Token(DurationFormatUtils.H, 1),\n+ new DurationFormatUtils.Token(DurationFormatUtils.H, 2),\n new DurationFormatUtils.Token(new StringBuilder("":""), 1),\n new DurationFormatUtils.Token(DurationFormatUtils.m, 2),\n new DurationFormatUtils.Token(new StringBuilder("":""), 1),\n new DurationFormatUtils.Token(DurationFormatUtils.s, 2),\n new DurationFormatUtils.Token(new StringBuilder("".""), 1),\n- new DurationFormatUtils.Token(DurationFormatUtils.S, 3)}, DurationFormatUtils.lexx(""H:mm:ss.SSS""));\n+ new DurationFormatUtils.Token(DurationFormatUtils.S, 3)}, DurationFormatUtils.lexx(""HH:mm:ss.SSS""));\n \n // test the iso extended format\n assertArrayEquals(new DurationFormatUtils.Token[]{\ndiff --git a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java\nindex f0404edfd..3e464cb66 100644\n--- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java\n@@ -52,7 +52,7 @@ public class StopWatchTest {\n public void testStopWatchSimpleGet(){\n final StopWatch watch = new StopWatch();\n assertEquals(0, watch.getTime());\n- assertEquals(""0:00:00.000"", watch.toString());\n+ assertEquals(""00:00:00.000"", watch.toString());\n \n watch.start();\n try {Thread.sleep(500);} catch (final InterruptedException ex) {}\n@@ -74,7 +74,7 @@ public class StopWatchTest {\n final long totalTime = watch.getTime();\n \n assertEquals(""Formatted split string not the correct length"", \n- splitStr.length(), 11);\n+ splitStr.length(), 12);\n assertTrue(splitTime >= 500);\n assertTrue(splitTime < 700);\n assertTrue(totalTime >= 1500);'" True,Delta,-1,commons-lang,fd54d42f78ae17a96fc005d2fcd080807343aad7,00dc479f6a1d204d557f4cb1d981ba236fe09565,org.apache.commons.lang3.time.DurationFormatUtilsTest.testFormatDurationHMS,False,[],,,,org.apache.commons.lang3.time.durationformatutils.formatdurationhms(long),"u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex 21e11dc65..8f92d52c4 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -165,31 +165,31 @@ public class DurationFormatUtilsTest {\n @Test\n public void testFormatDurationHMS() {\n long time = 0;\n- assertEquals(""0:00:00.000"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.000"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 1;\n- assertEquals(""0:00:00.001"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.001"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 15;\n- assertEquals(""0:00:00.015"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.015"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 165;\n- assertEquals(""0:00:00.165"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:00.165"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 1675;\n- assertEquals(""0:00:01.675"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:01.675"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 13465;\n- assertEquals(""0:00:13.465"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:00:13.465"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 72789;\n- assertEquals(""0:01:12.789"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:01:12.789"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 12789 + 32 60000;\n- assertEquals(""0:32:12.789"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""00:32:12.789"", DurationFormatUtils.formatDurationHMS(time));\n \n time = 12789 + 62 60000;\n- assertEquals(""1:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n+ assertEquals(""01:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n }\n \n @Test(expected = IllegalArgumentException.class)\n@@ -367,13 +367,13 @@ public class DurationFormatUtilsTest {\n \n // tests the ISO 8601-like\n assertArrayEquals(new DurationFormatUtils.Token[]{\n- new DurationFormatUtils.Token(DurationFormatUtils.H, 1),\n+ new DurationFormatUtils.Token(DurationFormatUtils.H, 2),\n new DurationFormatUtils.Token(new StringBuilder("":""), 1),\n new DurationFormatUtils.Token(DurationFormatUtils.m, 2),\n new DurationFormatUtils.Token(new StringBuilder("":""), 1),\n new DurationFormatUtils.Token(DurationFormatUtils.s, 2),\n new DurationFormatUtils.Token(new StringBuilder("".""), 1),\n- new DurationFormatUtils.Token(DurationFormatUtils.S, 3)}, DurationFormatUtils.lexx(""H:mm:ss.SSS""));\n+ new DurationFormatUtils.Token(DurationFormatUtils.S, 3)}, DurationFormatUtils.lexx(""HH:mm:ss.SSS""));\n \n // test the iso extended format\n assertArrayEquals(new DurationFormatUtils.Token[]{\ndiff --git a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java\nindex f0404edfd..3e464cb66 100644\n--- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java\n@@ -52,7 +52,7 @@ public class StopWatchTest {\n public void testStopWatchSimpleGet(){\n final StopWatch watch = new StopWatch();\n assertEquals(0, watch.getTime());\n- assertEquals(""0:00:00.000"", watch.toString());\n+ assertEquals(""00:00:00.000"", watch.toString());\n \n watch.start();\n try {Thread.sleep(500);} catch (final InterruptedException ex) {}\n@@ -74,7 +74,7 @@ public class StopWatchTest {\n final long totalTime = watch.getTime();\n \n assertEquals(""Formatted split string not the correct length"", \n- splitStr.length(), 11);\n+ splitStr.length(), 12);\n assertTrue(splitTime >= 500);\n assertTrue(splitTime < 700);\n assertTrue(totalTime >= 1500);'"
valid,type,issue,module,commit,parent,testcase,has_test_annotation,traces,bugged_components,description,extra_description,blamed_components,diff True,Regression,-1,commons-lang,64ef8a80224443c81dfb198cbc567e1b2b9356a2,358f139d1316df2b8efd7610afa3aa68d165334f,org.apache.commons.lang3.time.DurationFormatUtilsTest.testFormatNegativeDurationWords,False,[],,,,"org.apache.commons.lang3.time.durationformatutils.formatduration(long,string,boolean)@org.apache.commons.lang3.time.durationformatutils.formatperiod(long,long,string,boolean,timezone)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex ec6603fdd..21e11dc65 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -157,6 +157,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1 day 1 hour 1 minute 1 second"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationWords() throws Exception {\n+ DurationFormatUtils.formatDurationWords(-5000, true, true);\n+ }\n+\n @Test\n public void testFormatDurationHMS() {\n long time = 0;\n@@ -187,6 +192,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationHMS() throws Exception {\n+ DurationFormatUtils.formatDurationHMS(-5000);\n+ }\n+\n @Test\n public void testFormatDurationISO() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatDurationISO(0L));\n@@ -196,6 +206,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""P0Y0M0DT0H1M15.321S"", DurationFormatUtils.formatDurationISO(75321L));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationISO() throws Exception {\n+ DurationFormatUtils.formatDurationISO(-5000);\n+ }\n+\n @Test\n public void testFormatDuration() {\n long duration = 0;\n@@ -234,6 +249,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""0 0 "" + days, DurationFormatUtils.formatDuration(duration, ""y M d""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDuration() throws Exception {\n+ DurationFormatUtils.formatDuration(-5000, ""S"", true);\n+ }\n+\n @Test\n public void testFormatPeriodISO() {\n final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n@@ -262,6 +282,11 @@ public class DurationFormatUtilsTest {\n // assertEquals(""P1Y2M3DT10H30M"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodISOStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriodISO(5000, 2000);\n+ }\n+\n @Test\n public void testFormatPeriodISOMethod() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatPeriodISO(0L, 0L));\n@@ -323,6 +348,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""048"", DurationFormatUtils.formatPeriod(time1970, time, ""MMM""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodeStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriod(5000, 2500, ""yy/MM"");\n+ }\n+\n @Test\n public void testLexx() {\n // tests each constant'" True,Regression,-1,commons-lang,64ef8a80224443c81dfb198cbc567e1b2b9356a2,358f139d1316df2b8efd7610afa3aa68d165334f,org.apache.commons.lang3.time.DurationFormatUtilsTest.testFormatNegativeDurationISO,False,[],,,,"org.apache.commons.lang3.time.durationformatutils.formatduration(long,string,boolean)@org.apache.commons.lang3.time.durationformatutils.formatperiod(long,long,string,boolean,timezone)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex ec6603fdd..21e11dc65 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -157,6 +157,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1 day 1 hour 1 minute 1 second"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationWords() throws Exception {\n+ DurationFormatUtils.formatDurationWords(-5000, true, true);\n+ }\n+\n @Test\n public void testFormatDurationHMS() {\n long time = 0;\n@@ -187,6 +192,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationHMS() throws Exception {\n+ DurationFormatUtils.formatDurationHMS(-5000);\n+ }\n+\n @Test\n public void testFormatDurationISO() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatDurationISO(0L));\n@@ -196,6 +206,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""P0Y0M0DT0H1M15.321S"", DurationFormatUtils.formatDurationISO(75321L));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationISO() throws Exception {\n+ DurationFormatUtils.formatDurationISO(-5000);\n+ }\n+\n @Test\n public void testFormatDuration() {\n long duration = 0;\n@@ -234,6 +249,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""0 0 "" + days, DurationFormatUtils.formatDuration(duration, ""y M d""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDuration() throws Exception {\n+ DurationFormatUtils.formatDuration(-5000, ""S"", true);\n+ }\n+\n @Test\n public void testFormatPeriodISO() {\n final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n@@ -262,6 +282,11 @@ public class DurationFormatUtilsTest {\n // assertEquals(""P1Y2M3DT10H30M"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodISOStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriodISO(5000, 2000);\n+ }\n+\n @Test\n public void testFormatPeriodISOMethod() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatPeriodISO(0L, 0L));\n@@ -323,6 +348,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""048"", DurationFormatUtils.formatPeriod(time1970, time, ""MMM""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodeStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriod(5000, 2500, ""yy/MM"");\n+ }\n+\n @Test\n public void testLexx() {\n // tests each constant'" True,Regression,-1,commons-lang,64ef8a80224443c81dfb198cbc567e1b2b9356a2,358f139d1316df2b8efd7610afa3aa68d165334f,org.apache.commons.lang3.time.DurationFormatUtilsTest.testFormatPeriodISOStartGreaterEnd,False,[],,,,"org.apache.commons.lang3.time.durationformatutils.formatduration(long,string,boolean)@org.apache.commons.lang3.time.durationformatutils.formatperiod(long,long,string,boolean,timezone)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex ec6603fdd..21e11dc65 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -157,6 +157,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1 day 1 hour 1 minute 1 second"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationWords() throws Exception {\n+ DurationFormatUtils.formatDurationWords(-5000, true, true);\n+ }\n+\n @Test\n public void testFormatDurationHMS() {\n long time = 0;\n@@ -187,6 +192,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationHMS() throws Exception {\n+ DurationFormatUtils.formatDurationHMS(-5000);\n+ }\n+\n @Test\n public void testFormatDurationISO() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatDurationISO(0L));\n@@ -196,6 +206,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""P0Y0M0DT0H1M15.321S"", DurationFormatUtils.formatDurationISO(75321L));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationISO() throws Exception {\n+ DurationFormatUtils.formatDurationISO(-5000);\n+ }\n+\n @Test\n public void testFormatDuration() {\n long duration = 0;\n@@ -234,6 +249,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""0 0 "" + days, DurationFormatUtils.formatDuration(duration, ""y M d""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDuration() throws Exception {\n+ DurationFormatUtils.formatDuration(-5000, ""S"", true);\n+ }\n+\n @Test\n public void testFormatPeriodISO() {\n final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n@@ -262,6 +282,11 @@ public class DurationFormatUtilsTest {\n // assertEquals(""P1Y2M3DT10H30M"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodISOStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriodISO(5000, 2000);\n+ }\n+\n @Test\n public void testFormatPeriodISOMethod() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatPeriodISO(0L, 0L));\n@@ -323,6 +348,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""048"", DurationFormatUtils.formatPeriod(time1970, time, ""MMM""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodeStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriod(5000, 2500, ""yy/MM"");\n+ }\n+\n @Test\n public void testLexx() {\n // tests each constant'" True,Regression,-1,commons-lang,64ef8a80224443c81dfb198cbc567e1b2b9356a2,358f139d1316df2b8efd7610afa3aa68d165334f,org.apache.commons.lang3.time.DurationFormatUtilsTest.testFormatPeriodeStartGreaterEnd,False,[],,,,"org.apache.commons.lang3.time.durationformatutils.formatduration(long,string,boolean)@org.apache.commons.lang3.time.durationformatutils.formatperiod(long,long,string,boolean,timezone)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex ec6603fdd..21e11dc65 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -157,6 +157,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1 day 1 hour 1 minute 1 second"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationWords() throws Exception {\n+ DurationFormatUtils.formatDurationWords(-5000, true, true);\n+ }\n+\n @Test\n public void testFormatDurationHMS() {\n long time = 0;\n@@ -187,6 +192,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationHMS() throws Exception {\n+ DurationFormatUtils.formatDurationHMS(-5000);\n+ }\n+\n @Test\n public void testFormatDurationISO() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatDurationISO(0L));\n@@ -196,6 +206,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""P0Y0M0DT0H1M15.321S"", DurationFormatUtils.formatDurationISO(75321L));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationISO() throws Exception {\n+ DurationFormatUtils.formatDurationISO(-5000);\n+ }\n+\n @Test\n public void testFormatDuration() {\n long duration = 0;\n@@ -234,6 +249,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""0 0 "" + days, DurationFormatUtils.formatDuration(duration, ""y M d""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDuration() throws Exception {\n+ DurationFormatUtils.formatDuration(-5000, ""S"", true);\n+ }\n+\n @Test\n public void testFormatPeriodISO() {\n final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n@@ -262,6 +282,11 @@ public class DurationFormatUtilsTest {\n // assertEquals(""P1Y2M3DT10H30M"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodISOStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriodISO(5000, 2000);\n+ }\n+\n @Test\n public void testFormatPeriodISOMethod() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatPeriodISO(0L, 0L));\n@@ -323,6 +348,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""048"", DurationFormatUtils.formatPeriod(time1970, time, ""MMM""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodeStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriod(5000, 2500, ""yy/MM"");\n+ }\n+\n @Test\n public void testLexx() {\n // tests each constant'" True,Regression,-1,commons-lang,64ef8a80224443c81dfb198cbc567e1b2b9356a2,358f139d1316df2b8efd7610afa3aa68d165334f,org.apache.commons.lang3.time.DurationFormatUtilsTest.testFormatNegativeDuration,False,[],,,,"org.apache.commons.lang3.time.durationformatutils.formatduration(long,string,boolean)@org.apache.commons.lang3.time.durationformatutils.formatperiod(long,long,string,boolean,timezone)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex ec6603fdd..21e11dc65 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -157,6 +157,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1 day 1 hour 1 minute 1 second"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationWords() throws Exception {\n+ DurationFormatUtils.formatDurationWords(-5000, true, true);\n+ }\n+\n @Test\n public void testFormatDurationHMS() {\n long time = 0;\n@@ -187,6 +192,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationHMS() throws Exception {\n+ DurationFormatUtils.formatDurationHMS(-5000);\n+ }\n+\n @Test\n public void testFormatDurationISO() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatDurationISO(0L));\n@@ -196,6 +206,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""P0Y0M0DT0H1M15.321S"", DurationFormatUtils.formatDurationISO(75321L));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationISO() throws Exception {\n+ DurationFormatUtils.formatDurationISO(-5000);\n+ }\n+\n @Test\n public void testFormatDuration() {\n long duration = 0;\n@@ -234,6 +249,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""0 0 "" + days, DurationFormatUtils.formatDuration(duration, ""y M d""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDuration() throws Exception {\n+ DurationFormatUtils.formatDuration(-5000, ""S"", true);\n+ }\n+\n @Test\n public void testFormatPeriodISO() {\n final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n@@ -262,6 +282,11 @@ public class DurationFormatUtilsTest {\n // assertEquals(""P1Y2M3DT10H30M"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodISOStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriodISO(5000, 2000);\n+ }\n+\n @Test\n public void testFormatPeriodISOMethod() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatPeriodISO(0L, 0L));\n@@ -323,6 +348,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""048"", DurationFormatUtils.formatPeriod(time1970, time, ""MMM""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodeStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriod(5000, 2500, ""yy/MM"");\n+ }\n+\n @Test\n public void testLexx() {\n // tests each constant'" True,Regression,-1,commons-lang,64ef8a80224443c81dfb198cbc567e1b2b9356a2,358f139d1316df2b8efd7610afa3aa68d165334f,org.apache.commons.lang3.time.DurationFormatUtilsTest.testFormatNegativeDurationHMS,False,[],,,,"org.apache.commons.lang3.time.durationformatutils.formatduration(long,string,boolean)@org.apache.commons.lang3.time.durationformatutils.formatperiod(long,long,string,boolean,timezone)","u'diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\nindex ec6603fdd..21e11dc65 100644\n--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java\n@@ -157,6 +157,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1 day 1 hour 1 minute 1 second"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationWords() throws Exception {\n+ DurationFormatUtils.formatDurationWords(-5000, true, true);\n+ }\n+\n @Test\n public void testFormatDurationHMS() {\n long time = 0;\n@@ -187,6 +192,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""1:02:12.789"", DurationFormatUtils.formatDurationHMS(time));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationHMS() throws Exception {\n+ DurationFormatUtils.formatDurationHMS(-5000);\n+ }\n+\n @Test\n public void testFormatDurationISO() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatDurationISO(0L));\n@@ -196,6 +206,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""P0Y0M0DT0H1M15.321S"", DurationFormatUtils.formatDurationISO(75321L));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDurationISO() throws Exception {\n+ DurationFormatUtils.formatDurationISO(-5000);\n+ }\n+\n @Test\n public void testFormatDuration() {\n long duration = 0;\n@@ -234,6 +249,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""0 0 "" + days, DurationFormatUtils.formatDuration(duration, ""y M d""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatNegativeDuration() throws Exception {\n+ DurationFormatUtils.formatDuration(-5000, ""S"", true);\n+ }\n+\n @Test\n public void testFormatPeriodISO() {\n final TimeZone timeZone = TimeZone.getTimeZone(""GMT-3"");\n@@ -262,6 +282,11 @@ public class DurationFormatUtilsTest {\n // assertEquals(""P1Y2M3DT10H30M"", text);\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodISOStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriodISO(5000, 2000);\n+ }\n+\n @Test\n public void testFormatPeriodISOMethod() {\n assertEquals(""P0Y0M0DT0H0M0.000S"", DurationFormatUtils.formatPeriodISO(0L, 0L));\n@@ -323,6 +348,11 @@ public class DurationFormatUtilsTest {\n assertEquals(""048"", DurationFormatUtils.formatPeriod(time1970, time, ""MMM""));\n }\n \n+ @Test(expected = IllegalArgumentException.class)\n+ public void testFormatPeriodeStartGreaterEnd() throws Exception {\n+ DurationFormatUtils.formatPeriod(5000, 2500, ""yy/MM"");\n+ }\n+\n @Test\n public void testLexx() {\n // tests each constant'"
The issue you have reported seems to be resolved now. The extracted data can be found at releases by number commons-lang_373.
4