1   /*
2    * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3    * Copyright (C) 2003-2008 Frederico Caldeira Knabben
4    * 
5    * == BEGIN LICENSE ==
6    * 
7    * Licensed under the terms of any of the following licenses at your
8    * choice:
9    * 
10   *  - GNU General Public License Version 2 or later (the "GPL")
11   *    http://www.gnu.org/licenses/gpl.html
12   * 
13   *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14   *    http://www.gnu.org/licenses/lgpl.html
15   * 
16   *  - Mozilla Public License Version 1.1 or later (the "MPL")
17   *    http://www.mozilla.org/MPL/MPL-1.1.html
18   * 
19   * == END LICENSE ==
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   * Tests for {@link Utils}.
31   * 
32   * @version $Id: UtilsTest.java 2168 2008-07-03 21:47:29Z mosipov $
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  }