01: /*
02: * $Id: TimeTest.java 459379 2006-02-16 23:14:18Z jonl $ $Revision:
03: * 1.6 $ $Date: 2006-02-17 00:14:18 +0100 (Fri, 17 Feb 2006) $
04: *
05: * ==================================================================== Licensed
06: * under the Apache License, Version 2.0 (the "License"); you may not use this
07: * file except in compliance with the License. You may obtain a copy of the
08: * License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15: * License for the specific language governing permissions and limitations under
16: * the License.
17: */
18: package wicket.util.time;
19:
20: import java.text.ParseException;
21: import java.util.Calendar;
22:
23: import junit.framework.Assert;
24: import junit.framework.TestCase;
25:
26: /**
27: * Test cases for this object
28: *
29: * @author Jonathan Locke
30: */
31: public final class TimeTest extends TestCase {
32: /**
33: *
34: * @throws ParseException
35: */
36: public void test() throws ParseException {
37: final Time start = Time.now();
38:
39: // TODO Post 1.2: Bug: Eelco mentioned this test fails on his computer
40: // from time to time. I have seen this and it's very weird -- Jonathan
41: // Assert.assertTrue(Time.now().after(start) || Time.now().equals(start));
42:
43: final Time birthday = Time.parseDate("1966.06.01");
44:
45: Assert.assertEquals(1966, birthday.getYear());
46: Assert.assertEquals(Calendar.JUNE, birthday.getMonth());
47: Assert.assertEquals(1, birthday.getDayOfMonth());
48:
49: final String y2k = "2000.01.01-12.00am";
50:
51: Assert.assertEquals(y2k, Time.valueOf(y2k).toString());
52: }
53: }
|