1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.resource; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import org.junit.Test; |
26 |
|
|
27 |
|
import static org.junit.Assert.*; |
28 |
|
|
29 |
|
|
30 |
|
@link |
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.2 |
|
35 |
|
public class ResourceReferenceHandlerTest |
36 |
|
{ |
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 3 |
Complexity Density: 1.5 |
|
37 |
|
private class TestableResourceReferenceHandler extends AbstractResourceReferenceHandler<ResourceType> |
38 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
2 |
TestableResourceReferenceHandler(int priority)... |
40 |
|
{ |
41 |
2 |
setPriority(priority); |
42 |
|
} |
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
44 |
1 |
@Override... |
45 |
|
public List<ResourceType> getSupportedResourceReferences() |
46 |
|
{ |
47 |
1 |
return Arrays.asList(new ResourceType("test")); |
48 |
|
} |
49 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
50 |
0 |
@Override... |
51 |
|
public void handle(ResourceReference reference, ResourceReferenceHandlerChain chain) throws |
52 |
|
ResourceReferenceHandlerException |
53 |
|
{ |
54 |
|
} |
55 |
|
}; |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
57 |
1 |
@Test... |
58 |
|
public void priority() |
59 |
|
{ |
60 |
1 |
ResourceReferenceHandler handler1 = new TestableResourceReferenceHandler(500); |
61 |
1 |
assertEquals(500, handler1.getPriority()); |
62 |
1 |
assertTrue(handler1.getSupportedResourceReferences().contains(new ResourceType("test"))); |
63 |
|
|
64 |
1 |
ResourceReferenceHandler handler2 = new TestableResourceReferenceHandler(200); |
65 |
1 |
assertEquals(300, handler1.compareTo(handler2)); |
66 |
|
} |
67 |
|
} |