1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package net.fckeditor.tool;
22
23 import static org.junit.Assert.*;
24 import java.util.HashSet;
25 import java.util.Set;
26
27 import org.junit.Test;
28
29
30
31
32
33
34 public class UtilsTest {
35
36 @Test
37 public void getSet01() {
38 Set<String> set = new HashSet<String>();
39 set.add("a");
40 set.add("ab");
41 set.add("c");
42
43 Set<String> newSet = Utils.getSet("a|Ab|c", "|");
44 for (String string : newSet) {
45 assertTrue(set.contains(string));
46 }
47 }
48
49 @Test
50 public void getSet02() {
51 Set<String> set = new HashSet<String>();
52 set.add("png");
53 set.add("jpg");
54 set.add("gif");
55
56 Set<String> newSet = Utils.getSet("png|jpg|gif");
57 for (String string : newSet) {
58 assertTrue(set.contains(string));
59 }
60 }
61
62 @Test
63 public void getSet03() {
64 Set<String> set = Utils.getSet(null);
65 assertTrue(set != null);
66 assertTrue(set.isEmpty());
67 }
68
69 @Test
70 public void getSet04() {
71 Set<String> set = Utils.getSet("");
72 assertTrue(set != null);
73 assertTrue(set.isEmpty());
74 }
75
76 }