1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.extension.internal.converter; |
21 |
|
|
22 |
|
import org.junit.Rule; |
23 |
|
import org.junit.Test; |
24 |
|
import org.xwiki.component.manager.ComponentLookupException; |
25 |
|
import org.xwiki.extension.ExtensionId; |
26 |
|
import org.xwiki.extension.version.internal.DefaultVersion; |
27 |
|
import org.xwiki.properties.ConverterManager; |
28 |
|
import org.xwiki.properties.internal.DefaultConverterManager; |
29 |
|
import org.xwiki.test.annotation.AllComponents; |
30 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
31 |
|
|
32 |
|
import static org.junit.Assert.assertEquals; |
33 |
|
|
34 |
|
|
35 |
|
@link |
36 |
|
|
37 |
|
@version |
38 |
|
|
39 |
|
@AllComponents |
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.17 |
|
40 |
|
public class ExtensionIdConverterTest |
41 |
|
{ |
42 |
|
@Rule |
43 |
|
public MockitoComponentMockingRule<ConverterManager> mocker = |
44 |
|
new MockitoComponentMockingRule<ConverterManager>(DefaultConverterManager.class); |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
46 |
1 |
@Test... |
47 |
|
public void testConvertFromString() throws ComponentLookupException |
48 |
|
{ |
49 |
1 |
assertEquals(new ExtensionId("id"), this.mocker.getComponentUnderTest().convert(ExtensionId.class, "id")); |
50 |
1 |
assertEquals(new ExtensionId("id", new DefaultVersion("1.0")), |
51 |
|
this.mocker.getComponentUnderTest().convert(ExtensionId.class, "id/1.0")); |
52 |
1 |
assertEquals(new ExtensionId("id\\", new DefaultVersion("1.0")), |
53 |
|
this.mocker.getComponentUnderTest().convert(ExtensionId.class, "id\\\\/1.0")); |
54 |
|
|
55 |
1 |
assertEquals(new ExtensionId("id/1.0"), |
56 |
|
this.mocker.getComponentUnderTest().convert(ExtensionId.class, "id\\/1.0")); |
57 |
1 |
assertEquals(new ExtensionId("/1.0"), this.mocker.getComponentUnderTest().convert(ExtensionId.class, "\\/1.0")); |
58 |
1 |
assertEquals(new ExtensionId("id\\/1.0"), |
59 |
|
this.mocker.getComponentUnderTest().convert(ExtensionId.class, "id\\\\\\/1.0")); |
60 |
|
} |
61 |
|
} |