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