1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.properties.internal.converter; |
21 |
|
|
22 |
|
import java.lang.reflect.Type; |
23 |
|
|
24 |
|
import org.junit.Assert; |
25 |
|
import org.junit.Before; |
26 |
|
import org.junit.Test; |
27 |
|
import org.xwiki.component.descriptor.ComponentRole; |
28 |
|
import org.xwiki.component.util.DefaultParameterizedType; |
29 |
|
import org.xwiki.properties.ConverterManager; |
30 |
|
import org.xwiki.test.jmock.AbstractComponentTestCase; |
31 |
|
|
32 |
|
|
33 |
|
@link |
34 |
|
|
35 |
|
@version |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 3 |
Complexity Density: 0.3 |
|
37 |
|
public class TypeConverterTest extends AbstractComponentTestCase |
38 |
|
{ |
39 |
|
private ConverterManager converterManager; |
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
41 |
2 |
@Before... |
42 |
|
@Override |
43 |
|
public void setUp() throws Exception |
44 |
|
{ |
45 |
2 |
super.setUp(); |
46 |
|
|
47 |
2 |
this.converterManager = getComponentManager().getInstance(ConverterManager.class); |
48 |
|
} |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
50 |
1 |
@Test... |
51 |
|
public void testConvertToType() |
52 |
|
{ |
53 |
1 |
Type simpleType = ComponentRole.class; |
54 |
1 |
Assert.assertEquals(simpleType, |
55 |
|
this.converterManager.convert(Type.class, "org.xwiki.component.descriptor.ComponentRole")); |
56 |
|
|
57 |
1 |
Type genericsType = new DefaultParameterizedType(null, ComponentRole.class, String.class); |
58 |
1 |
Assert |
59 |
|
.assertEquals(genericsType, this.converterManager.convert(Type.class, |
60 |
|
"org.xwiki.component.descriptor.ComponentRole< java.lang.String >")); |
61 |
|
} |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
63 |
1 |
@Test... |
64 |
|
public void testConvertToString() |
65 |
|
{ |
66 |
1 |
Type simpleType = ComponentRole.class; |
67 |
1 |
Assert.assertEquals("org.xwiki.component.descriptor.ComponentRole", |
68 |
|
this.converterManager.convert(String.class, simpleType)); |
69 |
|
|
70 |
1 |
Type genericsType = new DefaultParameterizedType(null, ComponentRole.class, String.class); |
71 |
1 |
Assert.assertEquals("org.xwiki.component.descriptor.ComponentRole< java.lang.String >", |
72 |
|
this.converterManager.convert(String.class, genericsType)); |
73 |
|
} |
74 |
|
} |