1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.model.reference; |
21 |
|
|
22 |
|
import org.junit.Test; |
23 |
|
import org.xwiki.model.EntityType; |
24 |
|
|
25 |
|
import org.junit.Assert; |
26 |
|
|
27 |
|
|
28 |
|
@link |
29 |
|
|
30 |
|
@version |
31 |
|
@since |
32 |
|
|
|
|
| 80% |
Uncovered Elements: 3 (15) |
Complexity: 6 |
Complexity Density: 0.5 |
|
33 |
|
public class SpaceReferenceTest |
34 |
|
{ |
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
1PASS
|
|
35 |
1 |
@Test... |
36 |
|
public void testInvalidType() |
37 |
|
{ |
38 |
1 |
try { |
39 |
1 |
new SpaceReference(new EntityReference("space", EntityType.WIKI)); |
40 |
0 |
Assert.fail("Should have thrown an exception here"); |
41 |
|
} catch (IllegalArgumentException expected) { |
42 |
1 |
Assert.assertEquals("Invalid type [WIKI] for a space reference", expected.getMessage()); |
43 |
|
} |
44 |
|
} |
45 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
1PASS
|
|
46 |
1 |
@Test... |
47 |
|
public void testInvalidNullParent() |
48 |
|
{ |
49 |
1 |
try { |
50 |
1 |
new SpaceReference("page", (WikiReference) null); |
51 |
0 |
Assert.fail("Should have thrown an exception here"); |
52 |
|
} catch (IllegalArgumentException expected) { |
53 |
1 |
Assert.assertEquals("Invalid parent reference [null] in a space reference", expected.getMessage()); |
54 |
|
} |
55 |
|
} |
56 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
1PASS
|
|
57 |
1 |
@Test... |
58 |
|
public void testInvalidParentType() |
59 |
|
{ |
60 |
1 |
try { |
61 |
1 |
new SpaceReference(new EntityReference("space", EntityType.SPACE, |
62 |
|
new EntityReference("whatever", EntityType.DOCUMENT, null))); |
63 |
0 |
Assert.fail("Should have thrown an exception here"); |
64 |
|
} catch (IllegalArgumentException expected) { |
65 |
1 |
Assert.assertEquals("Invalid parent reference [Document whatever] in a space reference", |
66 |
|
expected.getMessage()); |
67 |
|
} |
68 |
|
} |
69 |
|
} |