From 9c6d3ea78fa936c8eedbd72236fe3f6e217c2b96 Mon Sep 17 00:00:00 2001
From: Henri Yandell 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.
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"),