1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.model.internal.reference; |
21 |
|
|
22 |
|
import org.junit.Assert; |
23 |
|
import org.junit.Before; |
24 |
|
import org.junit.Test; |
25 |
|
import org.xwiki.component.util.ReflectionUtils; |
26 |
|
import org.xwiki.model.reference.DocumentReference; |
27 |
|
import org.xwiki.model.reference.DocumentReferenceResolver; |
28 |
|
import org.xwiki.model.reference.EntityReference; |
29 |
|
|
30 |
|
|
31 |
|
@link |
32 |
|
|
33 |
|
@version |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
35 |
|
public class DefaultReferenceDocumentReferenceResolverTest |
36 |
|
{ |
37 |
|
private DocumentReferenceResolver<EntityReference> resolver; |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
39 |
1 |
@Before... |
40 |
|
public void setUp() throws Exception |
41 |
|
{ |
42 |
1 |
this.resolver = new DefaultReferenceDocumentReferenceResolver(); |
43 |
1 |
ReflectionUtils.setFieldValue(this.resolver, "entityReferenceResolver", |
44 |
|
new DefaultReferenceEntityReferenceResolver()); |
45 |
|
} |
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
47 |
1 |
@Test... |
48 |
|
public void testResolveWithExplicitDocumentReference() |
49 |
|
{ |
50 |
1 |
DocumentReference reference = this.resolver.resolve(null, new DocumentReference("wiki", "space", "page")); |
51 |
|
|
52 |
1 |
Assert.assertEquals("page", reference.getName()); |
53 |
1 |
Assert.assertEquals("space", reference.getLastSpaceReference().getName()); |
54 |
1 |
Assert.assertEquals("wiki", reference.getWikiReference().getName()); |
55 |
|
} |
56 |
|
} |