1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.listener.reference; |
21 |
|
|
22 |
|
import org.junit.Assert; |
23 |
|
import org.junit.Test; |
24 |
|
|
25 |
|
|
26 |
|
@link |
27 |
|
|
28 |
|
@version |
29 |
|
@since |
30 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 3 |
Complexity Density: 0.14 |
|
31 |
|
public class ResourceReferenceTest |
32 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
33 |
1 |
@Test... |
34 |
|
public void testToString() |
35 |
|
{ |
36 |
1 |
ResourceReference reference = new ResourceReference("reference", ResourceType.DOCUMENT); |
37 |
1 |
Assert.assertEquals("Typed = [true] Type = [doc] Reference = [reference]", reference.toString()); |
38 |
|
|
39 |
1 |
reference.addBaseReference("baseref1"); |
40 |
1 |
reference.addBaseReference("baseref2"); |
41 |
1 |
Assert.assertEquals("Typed = [true] Type = [doc] Reference = [reference] " |
42 |
|
+ "Base References = [[baseref1], [baseref2]]", reference.toString()); |
43 |
|
|
44 |
1 |
reference.setParameter("name1", "value1"); |
45 |
1 |
reference.setParameter("name2", "value2"); |
46 |
1 |
Assert.assertEquals("Typed = [true] Type = [doc] Reference = [reference] " |
47 |
|
+ "Base References = [[baseref1], [baseref2]] " |
48 |
|
+ "Parameters = [[name1] = [value1], [name2] = [value2]]", reference.toString()); |
49 |
|
} |
50 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
51 |
1 |
@Test... |
52 |
|
public void testEquals() |
53 |
|
{ |
54 |
1 |
ResourceReference reference1 = new ResourceReference("reference", ResourceType.DOCUMENT); |
55 |
1 |
ResourceReference reference2 = new ResourceReference("reference", ResourceType.DOCUMENT); |
56 |
1 |
Assert.assertEquals(reference1, reference2); |
57 |
|
|
58 |
1 |
reference2.addBaseReference("base"); |
59 |
1 |
Assert.assertFalse(reference1.equals(reference2)); |
60 |
|
|
61 |
1 |
reference1.addBaseReference("base"); |
62 |
1 |
Assert.assertEquals(reference1, reference2); |
63 |
|
} |
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
65 |
1 |
@Test... |
66 |
|
public void testHashCode() |
67 |
|
{ |
68 |
1 |
ResourceReference reference1 = new ResourceReference("reference", ResourceType.DOCUMENT); |
69 |
1 |
ResourceReference reference2 = new ResourceReference("reference", ResourceType.DOCUMENT); |
70 |
1 |
Assert.assertEquals(reference1.hashCode(), reference2.hashCode()); |
71 |
|
|
72 |
1 |
reference1.addBaseReference("base"); |
73 |
1 |
reference2.addBaseReference("base"); |
74 |
1 |
Assert.assertEquals(reference1.hashCode(), reference2.hashCode()); |
75 |
|
} |
76 |
|
} |