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
34
35 @Deprecated
36 public class ExtensionsHandlerTest {
37
38 @Test
39 public void testIsAllowed01() {
40 ResourceType type = ResourceType.FILE;
41 ExtensionsHandler.setExtensionsAllowed(type, "a");
42 ExtensionsHandler.setExtensionsDenied(type, "b");
43 assertTrue(ExtensionsHandler.getExtensionsAllowed(type).isEmpty());
44 assertTrue(ExtensionsHandler.getExtensionsDenied(type).contains("b"));
45 assertFalse(ExtensionsHandler.isAllowed(type, "b"));
46 assertTrue(ExtensionsHandler.isAllowed(type, "a"));
47 assertTrue(ExtensionsHandler.isAllowed(type, "c"));
48 }
49
50 @Test
51 public void testIsAllowed02() {
52 ResourceType type = ResourceType.FILE;
53 ExtensionsHandler.setExtensionsAllowed(type, "a|b|c");
54 assertTrue(ExtensionsHandler.isAllowed(type, "a"));
55 assertTrue(ExtensionsHandler.isAllowed(type, "b"));
56 assertTrue(ExtensionsHandler.isAllowed(type, "c"));
57 assertFalse(ExtensionsHandler.isAllowed(type, "d"));
58 }
59
60 }