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.Rule; |
25 |
|
import org.junit.Test; |
26 |
|
import org.xwiki.component.util.ReflectionUtils; |
27 |
|
import org.xwiki.model.reference.DocumentReference; |
28 |
|
import org.xwiki.model.reference.DocumentReferenceResolver; |
29 |
|
import org.xwiki.test.annotation.ComponentList; |
30 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
31 |
|
|
32 |
|
|
33 |
|
@link |
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
38 |
|
@ComponentList({ |
39 |
|
DefaultSymbolScheme.class |
40 |
|
}) |
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
41 |
|
public class ExplicitStringDocumentReferenceResolverTest |
42 |
|
{ |
43 |
|
@Rule |
44 |
|
public MockitoComponentMockingRule<ExplicitStringEntityReferenceResolver> mocker = |
45 |
|
new MockitoComponentMockingRule<>(ExplicitStringEntityReferenceResolver.class); |
46 |
|
|
47 |
|
private DocumentReferenceResolver<String> resolver; |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
49 |
1 |
@Before... |
50 |
|
public void setUp() throws Exception |
51 |
|
{ |
52 |
1 |
this.resolver = new ExplicitStringDocumentReferenceResolver(); |
53 |
1 |
ReflectionUtils.setFieldValue(this.resolver, "entityReferenceResolver", this.mocker.getComponentUnderTest()); |
54 |
|
} |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
56 |
1 |
@Test... |
57 |
|
public void resolveWithExplicitDocumentReference() |
58 |
|
{ |
59 |
1 |
DocumentReference reference = this.resolver.resolve("", new DocumentReference("wiki", "space", "page")); |
60 |
|
|
61 |
1 |
Assert.assertEquals("page", reference.getName()); |
62 |
1 |
Assert.assertEquals("space", reference.getLastSpaceReference().getName()); |
63 |
1 |
Assert.assertEquals("wiki", reference.getWikiReference().getName()); |
64 |
|
} |
65 |
|
} |