01: /*
02: * $Id: TimeMapTest.java 456908 2005-06-05 20:49:57Z jdonnerstag $
03: * $Revision: 456908 $
04: * $Date: 2005-06-05 22:49:57 +0200 (Sun, 05 Jun 2005) $
05: *
06: * ====================================================================
07: * Licensed under the Apache License, Version 2.0 (the "License");
08: * you may not use this file except in compliance with the License.
09: * You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: */
19: package wicket.util.time;
20:
21: import java.text.ParseException;
22: import java.util.GregorianCalendar;
23: import java.util.Locale;
24:
25: import junit.framework.Assert;
26: import junit.framework.TestCase;
27:
28: /**
29: * Test cases for this object
30: * @author Jonathan Locke
31: */
32: public final class TimeMapTest extends TestCase {
33: /**
34: *
35: * @throws ParseException
36: */
37: public void testSimpleStaticTimeFrame() throws ParseException {
38: final TimeMap map = new TimeMap();
39: final Time start = Time.valueOf(TimeOfDay.valueOf(
40: new GregorianCalendar(Locale.ENGLISH), "3.14pm"));
41: final Time end = Time.valueOf(TimeOfDay.valueOf(
42: new GregorianCalendar(Locale.ENGLISH), "3.20pm"));
43: final String value = "test";
44:
45: map.put(TimeFrame.valueOf(start, end), value);
46: Assert.assertEquals(value, map.get(Time.valueOf(TimeOfDay
47: .valueOf(new GregorianCalendar(Locale.ENGLISH),
48: "3.15pm"))));
49: Assert.assertNull(map.get(Time.valueOf(TimeOfDay.valueOf(
50: new GregorianCalendar(Locale.ENGLISH), "3.21pm"))));
51: Assert.assertNull(map.get(Time.valueOf(TimeOfDay.valueOf(
52: new GregorianCalendar(Locale.ENGLISH), "3.13pm"))));
53: }
54: }
|