-
Notifications
You must be signed in to change notification settings - Fork 17
/
URLPatternTest.java
57 lines (37 loc) · 1.53 KB
/
URLPatternTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package jakarta.security.jacc;
public class URLPatternTest {
private final static int DEPTH_IS_ALWAYS_1 = 1;
private static void assertDepthForPattern(int expected, int actual, String pattern) {
assert actual == expected : "For '" + pattern + "' pattern expected depth is " + expected;
}
public void testDepthOfDefaultPattern() {
URLPattern spec = new URLPattern();
int depth = spec.getPatternDepth();
assertDepthForPattern(DEPTH_IS_ALWAYS_1, depth, "<default>");
}
public void testDepthOfRoot() {
URLPattern spec = new URLPattern("/");
int depth = spec.getPatternDepth();
assertDepthForPattern(DEPTH_IS_ALWAYS_1, depth, "/");
}
public void testDepthOfTwoSlashPattern() {
URLPattern spec = new URLPattern("/unit/test");
int depth = spec.getPatternDepth();
assertDepthForPattern(DEPTH_IS_ALWAYS_1, depth, "/unit/test");
}
public void testDepthOfThreeSlashPattern() {
URLPattern spec = new URLPattern("/unit/test/");
int depth = spec.getPatternDepth();
assertDepthForPattern(DEPTH_IS_ALWAYS_1, depth, "/unit/test/");
}
public void testDepthOfTwoImmediateSlashPattern() {
URLPattern spec = new URLPattern("/unit//test/");
int depth = spec.getPatternDepth();
assertDepthForPattern(DEPTH_IS_ALWAYS_1, depth, "/unit//test/");
}
public void testDepthOfTwoImmediateSlashAtBeginingPattern() {
URLPattern spec = new URLPattern("//unit/test/");
int depth = spec.getPatternDepth();
assertDepthForPattern(DEPTH_IS_ALWAYS_1, depth, "//unit/test/");
}
}