1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.logging.marker; |
21 |
|
|
22 |
|
import org.junit.Assert; |
23 |
|
import org.junit.Before; |
24 |
|
import org.junit.Test; |
25 |
|
import org.slf4j.Marker; |
26 |
|
import org.slf4j.MarkerFactory; |
27 |
|
|
28 |
|
|
29 |
|
@link |
30 |
|
|
31 |
|
@version |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (36) |
Complexity: 12 |
Complexity Density: 0.5 |
|
33 |
|
public class TranslationMarkerTest |
34 |
|
{ |
35 |
|
private TranslationMarker marker; |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
37 |
11 |
@Before... |
38 |
|
public void setUp() |
39 |
|
{ |
40 |
11 |
this.marker = new TranslationMarker("translation.key"); |
41 |
|
} |
42 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
43 |
1 |
@Test... |
44 |
|
public void getTranslationKey() |
45 |
|
{ |
46 |
1 |
Assert.assertEquals("translation.key", this.marker.getTranslationKey()); |
47 |
|
} |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
49 |
1 |
@Test... |
50 |
|
public void getName() |
51 |
|
{ |
52 |
1 |
Assert.assertEquals(TranslationMarker.NAME, this.marker.getName()); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
55 |
1 |
@Test... |
56 |
|
public void add() |
57 |
|
{ |
58 |
1 |
this.marker.add(MarkerFactory.getMarker("marker")); |
59 |
|
} |
60 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
61 |
1 |
@Test... |
62 |
|
public void remove() |
63 |
|
{ |
64 |
1 |
Assert.assertFalse(this.marker.remove(null)); |
65 |
|
} |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
67 |
1 |
@Test... |
68 |
|
public void hasChildren() |
69 |
|
{ |
70 |
1 |
Assert.assertFalse(this.marker.hasChildren()); |
71 |
|
} |
72 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
73 |
1 |
@Test... |
74 |
|
public void hasReferences() |
75 |
|
{ |
76 |
1 |
Assert.assertFalse(this.marker.hasReferences()); |
77 |
|
} |
78 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
79 |
1 |
@Test... |
80 |
|
public void iterator() |
81 |
|
{ |
82 |
1 |
Assert.assertFalse(this.marker.iterator().hasNext()); |
83 |
|
} |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
85 |
1 |
@Test... |
86 |
|
public void containsString() |
87 |
|
{ |
88 |
1 |
Assert.assertFalse(this.marker.contains("name")); |
89 |
1 |
Assert.assertTrue(this.marker.contains(this.marker.getName())); |
90 |
|
} |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
92 |
1 |
@Test... |
93 |
|
public void containsMarker() |
94 |
|
{ |
95 |
1 |
Assert.assertFalse(this.marker.contains(MarkerFactory.getMarker("name"))); |
96 |
1 |
Assert.assertTrue(this.marker.contains(this.marker)); |
97 |
|
} |
98 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
99 |
1 |
@Test... |
100 |
|
public void testHashCode() |
101 |
|
{ |
102 |
1 |
Marker equalsTMarker = new TranslationMarker("translation.key"); |
103 |
1 |
Marker otherTMarker = new TranslationMarker("translation.otherkey"); |
104 |
1 |
Marker otherMarker = MarkerFactory.getMarker("name"); |
105 |
|
|
106 |
1 |
Assert.assertEquals(equalsTMarker.hashCode(), this.marker.hashCode()); |
107 |
1 |
Assert.assertFalse(this.marker.hashCode() == otherTMarker.hashCode()); |
108 |
1 |
Assert.assertFalse(this.marker.hashCode() == otherMarker.hashCode()); |
109 |
|
} |
110 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
111 |
1 |
@Test... |
112 |
|
public void testEquals() |
113 |
|
{ |
114 |
1 |
Marker equalsTMarker = new TranslationMarker("translation.key"); |
115 |
1 |
Marker otherTMarker = new TranslationMarker("translation.otherkey"); |
116 |
1 |
Marker otherMarker = MarkerFactory.getMarker("name"); |
117 |
|
|
118 |
1 |
Assert.assertEquals(equalsTMarker, this.marker); |
119 |
1 |
Assert.assertFalse(this.marker.equals(otherTMarker)); |
120 |
1 |
Assert.assertFalse(this.marker.equals(otherMarker)); |
121 |
|
} |
122 |
|
} |