1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package net.fckeditor.handlers;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertFalse;
25 import static org.junit.Assert.assertNotSame;
26 import static org.junit.Assert.assertNull;
27
28 import org.junit.Test;
29
30
31
32
33
34
35 public class ResourceTypeTest {
36
37 @Test
38 public void getType01() throws Exception {
39 assertNull(ResourceType.getResourceType("xyz"));
40 }
41
42 @Test
43 public void getType02() throws Exception {
44 assertEquals(ResourceType.FILE, ResourceType.getResourceType("File"));
45 }
46
47 @Test
48 public void getType03() throws Exception {
49 assertNotSame(ResourceType.IMAGE, ResourceType.getResourceType("ImaGe"));
50 }
51
52 @Test
53 public void getType04() throws Exception {
54 assertNull(ResourceType.getResourceType(null));
55 }
56
57 @Test
58 public void getType05() throws Exception {
59 assertNull(ResourceType.getResourceType(""));
60 }
61
62 @Test
63 public void isValid01() throws Exception {
64 assertFalse(ResourceType.isValidType("1234"));
65 }
66
67 @Test
68 public void isValid02() throws Exception {
69 assertFalse(ResourceType.isValidType("fLash"));
70 }
71
72 @Test
73 public void isValid03() throws Exception {
74 assertFalse(ResourceType.isValidType("MeDiA"));
75 }
76
77 @Test
78 public void getDefaultType01() throws Exception {
79 assertEquals(ResourceType.FILE, ResourceType
80 .getDefaultResourceType("wrong-type"));
81 }
82
83 @Test
84 public void getDefaultType02() throws Exception {
85 assertNotSame(ResourceType.FLASH, ResourceType
86 .getDefaultResourceType("flAsh"));
87 }
88
89 @Test
90 public void getDefaultType03() throws Exception {
91 assertEquals(ResourceType.FILE, ResourceType
92 .getDefaultResourceType(null));
93 }
94
95 @Test
96 public void getDefaultType04() throws Exception {
97 assertEquals(ResourceType.FILE, ResourceType
98 .getDefaultResourceType(""));
99 }
100
101 @Test
102 public void getDefaultType05() throws Exception {
103 assertNotSame(ResourceType.FILE, ResourceType
104 .getDefaultResourceType("Image"));
105 }
106 }