From 9c6d3ea78fa936c8eedbd72236fe3f6e217c2b96 Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Sun, 23 Jan 2011 05:25:03 +0000 Subject: [PATCH] Fixing javadoc for DateUtils.ceiling per LANG-672 git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1062326 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/lang3/time/DateUtils.java | 4 ++-- .../org/apache/commons/lang3/time/DateUtilsTest.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/time/DateUtils.java b/src/main/java/org/apache/commons/lang3/time/DateUtils.java index f4d80ecd0..9a24c00fa 100644 --- a/src/main/java/org/apache/commons/lang3/time/DateUtils.java +++ b/src/main/java/org/apache/commons/lang3/time/DateUtils.java @@ -848,8 +848,8 @@ public class DateUtils { * *

For example, if you had the datetime of 28 Mar 2002 * 13:45:01.231, if you passed with HOUR, it would return 28 Mar - * 2002 13:00:00.000. If this was passed with MONTH, it would - * return 1 Mar 2002 0:00:00.000.

+ * 2002 14:00:00.000. If this was passed with MONTH, it would + * return 1 Apr 2002 0:00:00.000.

* * @param date the date to work with * @param field the field from Calendar diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java index 032b0b184..68094f9e9 100644 --- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java @@ -1177,6 +1177,18 @@ public class DateUtilsTest extends TestCase { * Tests various values with the ceiling method */ public void testCeil() throws Exception { + // test javadoc + assertEquals("ceiling javadoc-1 failed", + dateTimeParser.parse("March 28, 2002 14:00:00.000"), + DateUtils.ceiling( + dateTimeParser.parse("March 28, 2002 13:45:01.231"), + Calendar.HOUR)); + assertEquals("ceiling javadoc-2 failed", + dateTimeParser.parse("April 1, 2002 00:00:00.000"), + DateUtils.ceiling( + dateTimeParser.parse("March 28, 2002 13:45:01.231"), + Calendar.MONTH)); + // tests public static Date ceiling(Date date, int field) assertEquals("ceiling year-1 failed", dateParser.parse("January 1, 2003"),