1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package waffle.servlet.spi;
25
26 import org.junit.jupiter.api.Assertions;
27 import org.junit.jupiter.api.Test;
28
29 import waffle.windows.auth.impl.WindowsAuthProviderImpl;
30
31
32
33
34 class SecurityFilterProviderCollectionTest {
35
36
37
38
39
40
41
42 @Test
43 void testDefaultCollection() throws ClassNotFoundException {
44 final SecurityFilterProviderCollection coll = new SecurityFilterProviderCollection(
45 new WindowsAuthProviderImpl());
46 Assertions.assertEquals(2, coll.size());
47 Assertions.assertNotNull(coll.getByClassName(NegotiateSecurityFilterProvider.class.getName()));
48 Assertions.assertNotNull(coll.getByClassName(BasicSecurityFilterProvider.class.getName()));
49 }
50
51
52
53
54
55
56
57 @Test
58 void testGetByClassNameInvalid() throws ClassNotFoundException {
59 final SecurityFilterProviderCollection coll = new SecurityFilterProviderCollection(
60 new WindowsAuthProviderImpl());
61 Assertions.assertThrows(ClassNotFoundException.class, () -> {
62 coll.getByClassName("classDoesNotExist");
63 });
64 }
65
66
67
68
69 @Test
70 void testIsSecurityPackageSupported() {
71 final SecurityFilterProviderCollection coll = new SecurityFilterProviderCollection(
72 new WindowsAuthProviderImpl());
73 Assertions.assertTrue(coll.isSecurityPackageSupported("NTLM"));
74 Assertions.assertTrue(coll.isSecurityPackageSupported("Negotiate"));
75 Assertions.assertTrue(coll.isSecurityPackageSupported("Basic"));
76 Assertions.assertFalse(coll.isSecurityPackageSupported(""));
77 Assertions.assertFalse(coll.isSecurityPackageSupported("Invalid"));
78 }
79 }