1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.internal.parser.reference; |
21 |
|
|
22 |
|
import org.junit.Assert; |
23 |
|
import org.junit.Rule; |
24 |
|
import org.junit.Test; |
25 |
|
import org.xwiki.properties.converter.Converter; |
26 |
|
import org.xwiki.rendering.listener.reference.ResourceReference; |
27 |
|
import org.xwiki.rendering.listener.reference.ResourceType; |
28 |
|
import org.xwiki.rendering.parser.ResourceReferenceParser; |
29 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
30 |
|
|
31 |
|
import static org.mockito.Mockito.when; |
32 |
|
|
33 |
|
|
34 |
|
@link |
35 |
|
|
36 |
|
@version |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
38 |
|
public class ResourceReferenceConverterTest |
39 |
|
{ |
40 |
|
@Rule |
41 |
|
public MockitoComponentMockingRule<Converter<ResourceReference>> mocker = |
42 |
|
new MockitoComponentMockingRule<Converter<ResourceReference>>(ResourceReferenceConverter.class); |
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
44 |
1 |
@Test... |
45 |
|
public void convertToResourceReference() throws Exception |
46 |
|
{ |
47 |
1 |
ResourceReference reference = new ResourceReference("reference", ResourceType.DOCUMENT); |
48 |
|
|
49 |
1 |
final ResourceReferenceParser parser = this.mocker.getInstance(ResourceReferenceParser.class); |
50 |
1 |
when(parser.parse("reference")).thenReturn(reference); |
51 |
|
|
52 |
1 |
Assert.assertSame(reference, this.mocker.getComponentUnderTest().convert(ResourceReference.class, "reference")); |
53 |
|
} |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
55 |
1 |
@Test... |
56 |
|
public void convertToResourceReferenceWhenNull() throws Exception |
57 |
|
{ |
58 |
1 |
Assert.assertNull(this.mocker.getComponentUnderTest().convert(ResourceReference.class, null)); |
59 |
|
} |
60 |
|
} |