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.assertFalse;
24 import static org.junit.Assert.assertTrue;
25
26 import org.junit.Test;
27
28
29
30
31
32
33 public class ExtensionsHandlerTest {
34
35 @Test
36 public void testIsAllowed01() {
37 ResourceTypeHandler type = ResourceTypeHandler.FILE;
38 ExtensionsHandler.setExtensionsAllowed(type, "a");
39 ExtensionsHandler.setExtensionsDenied(type, "b");
40 assertTrue(ExtensionsHandler.getExtensionsAllowed(type).isEmpty());
41 assertTrue(ExtensionsHandler.getExtensionsDenied(type).contains("b"));
42 assertFalse(ExtensionsHandler.isAllowed(type, "b"));
43 assertTrue(ExtensionsHandler.isAllowed(type, "a"));
44 assertTrue(ExtensionsHandler.isAllowed(type, "c"));
45 }
46
47 @Test
48 public void testIsAllowed02() {
49 ResourceTypeHandler type = ResourceTypeHandler.FILE;
50 ExtensionsHandler.setExtensionsAllowed(type, "a|b|c");
51 assertTrue(ExtensionsHandler.isAllowed(type, "a"));
52 assertTrue(ExtensionsHandler.isAllowed(type, "b"));
53 assertTrue(ExtensionsHandler.isAllowed(type, "c"));
54 assertFalse(ExtensionsHandler.isAllowed(type, "d"));
55 }
56
57 }