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
This commit is contained in:
Henri Yandell 2011-01-23 05:25:03 +00:00
parent 367e00e6ef
commit 9c6d3ea78f
2 changed files with 14 additions and 2 deletions

View File

@ -848,8 +848,8 @@ public class DateUtils {
*
* <p>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.</p>
* 2002 14:00:00.000. If this was passed with MONTH, it would
* return 1 Apr 2002 0:00:00.000.</p>
*
* @param date the date to work with
* @param field the field from <code>Calendar</code>

View File

@ -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"),