diff options
author | Dominik Stadler <centic@apache.org> | 2015-08-20 06:29:48 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2015-08-20 06:29:48 +0000 |
commit | a5f332536ed51f932ba10b7fb9d6ba4aac2b5941 (patch) | |
tree | 54f90221ad1b276c2ac3be57412126d492392d72 /src/testcases/org/apache/poi/ss/formula/atp | |
parent | e4a987e893e8496c72632b64ac7727185635d1c1 (diff) | |
download | poi-a5f332536ed51f932ba10b7fb9d6ba4aac2b5941.tar.gz poi-a5f332536ed51f932ba10b7fb9d6ba4aac2b5941.zip |
Somehow the Date formatting via SimpleDateFormatter fails on some CI machines, don't rely on this to avoid test-failures due to timezones/locales but rather compare the date directly.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1696710 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/formula/atp')
-rw-r--r-- | src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java index 417c56f303..94deb2db0a 100644 --- a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java +++ b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java @@ -32,8 +32,6 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import junit.framework.TestCase; - import org.apache.poi.ss.formula.OperationEvaluationContext; import org.apache.poi.ss.formula.TwoDEval; import org.apache.poi.ss.formula.eval.AreaEval; @@ -43,6 +41,8 @@ import org.apache.poi.ss.formula.eval.StringEval; import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.usermodel.DateUtil; +import junit.framework.TestCase; + /** * @author jfaenomoto@gmail.com */ @@ -88,57 +88,49 @@ public class TestWorkdayFunction extends TestCase { public void testReturnWorkdaysSpanningAWeekendSubtractingDays() { String startDate = "2013/09/30"; int days = -1; - String expectedWorkDay = "2013/09/27"; StringEval stringEval = new StringEval(startDate); double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{ stringEval, new NumberEval(days) }, EC)).getNumberValue(); assertEquals(41544.0, numberValue); Date date = DateUtil.getJavaDate(numberValue); - assertEquals(new Date(113, 8, 27), date); - assertEquals(expectedWorkDay, formatter.format(date)); + assertEquals("Should be 2013/09/27", new Date(113, 8, 27), date); } - + public void testReturnWorkdaysSpanningAWeekendAddingDays() { String startDate = "2013/09/27"; int days = 1; - String expectedWorkDay = "2013/09/30"; StringEval stringEval = new StringEval(startDate); double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{ stringEval, new NumberEval(days) }, EC)).getNumberValue(); assertEquals(41547.0, numberValue); Date date = DateUtil.getJavaDate(numberValue); - assertEquals(new Date(113, 8, 30), date); - assertEquals(expectedWorkDay, formatter.format(date)); + assertEquals("Should be 2013/09/30", new Date(113, 8, 30), date); } - + public void testReturnWorkdaysWhenStartIsWeekendAddingDays() { String startDate = "2013/10/06"; int days = 1; - String expectedWorkDay = "2013/10/07"; StringEval stringEval = new StringEval(startDate); double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{ stringEval, new NumberEval(days) }, EC)).getNumberValue(); assertEquals(41554.0, numberValue); Date date = DateUtil.getJavaDate(numberValue); - assertEquals(new Date(113, 9, 7), date); - assertEquals(expectedWorkDay, formatter.format(date)); + assertEquals("Should be 2013/10/07", new Date(113, 9, 7), date); } - + public void testReturnWorkdaysWhenStartIsWeekendSubtractingDays() { String startDate = "2013/10/06"; int days = -1; - String expectedWorkDay = "2013/10/04"; StringEval stringEval = new StringEval(startDate); double numberValue = ((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{ stringEval, new NumberEval(days) }, EC)).getNumberValue(); assertEquals(41551.0, numberValue); Date date = DateUtil.getJavaDate(numberValue); - assertEquals(new Date(113, 9, 4), date); - assertEquals(expectedWorkDay, formatter.format(date)); + assertEquals("Should be 2013/10/04", new Date(113, 9, 4), date); } public void testReturnWorkdaysWithDaysTruncated() { |