1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.joda.time.tz;
17
18 import java.lang.reflect.Constructor;
19 import java.lang.reflect.Modifier;
20 import java.util.Set;
21
22 import junit.framework.TestCase;
23 import junit.framework.TestSuite;
24
25 import org.joda.time.DateTimeZone;
26
27
28
29
30
31
32 public class TestUTCProvider extends TestCase {
33
34 private DateTimeZone zone = null;
35
36 public static void main(String[] args) {
37 junit.textui.TestRunner.run(suite());
38 }
39
40 public static TestSuite suite() {
41 return new TestSuite(TestUTCProvider.class);
42 }
43
44 public TestUTCProvider(String name) {
45 super(name);
46 }
47
48
49 public void testClass() throws Exception {
50 Class cls = UTCProvider.class;
51 assertEquals(true, Modifier.isPublic(cls.getModifiers()));
52
53 Constructor con = cls.getDeclaredConstructor((Class[]) null);
54 assertEquals(1, cls.getDeclaredConstructors().length);
55 assertEquals(true, Modifier.isPublic(con.getModifiers()));
56 }
57
58
59 public void testGetAvailableIDs() throws Exception {
60 Provider p = new UTCProvider();
61 Set set = p.getAvailableIDs();
62 assertEquals(1, set.size());
63 assertEquals("UTC", set.iterator().next());
64 }
65
66
67 public void testGetZone_String() throws Exception {
68 Provider p = new UTCProvider();
69 assertSame(DateTimeZone.UTC, p.getZone("UTC"));
70 assertEquals(null, p.getZone(null));
71 assertEquals(null, p.getZone("Europe/London"));
72 assertEquals(null, p.getZone("Blah"));
73 }
74
75 }