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; |
21 |
|
|
22 |
|
import java.awt.Color; |
23 |
|
|
24 |
|
import org.junit.Assert; |
25 |
|
import org.junit.Rule; |
26 |
|
import org.junit.Test; |
27 |
|
import org.xwiki.component.manager.ComponentLookupException; |
28 |
|
import org.xwiki.properties.ConverterManager; |
29 |
|
import org.xwiki.properties.converter.ConversionException; |
30 |
|
import org.xwiki.test.annotation.AllComponents; |
31 |
|
import org.xwiki.test.mockito.MockitoComponentMockingRule; |
32 |
|
|
33 |
|
|
34 |
|
@link |
35 |
|
|
36 |
|
@version |
37 |
|
|
38 |
|
@AllComponents |
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 5 |
Complexity Density: 1 |
|
39 |
|
public class DefaultConverterManagerTest |
40 |
|
{ |
41 |
|
@Rule |
42 |
|
public MockitoComponentMockingRule<ConverterManager> mocker = new MockitoComponentMockingRule<ConverterManager>( |
43 |
|
DefaultConverterManager.class); |
44 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
45 |
|
public enum TestEnum |
46 |
|
{ |
47 |
|
ENUMVALUE |
48 |
|
} |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
50 |
1 |
@Test... |
51 |
|
public void testConvert() throws ComponentLookupException |
52 |
|
{ |
53 |
1 |
Assert.assertEquals(Integer.valueOf(42), this.mocker.getComponentUnderTest().convert(Integer.class, "42")); |
54 |
|
} |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
56 |
1 |
@Test... |
57 |
|
public void testConvertEnum() throws ComponentLookupException |
58 |
|
{ |
59 |
1 |
Assert.assertEquals(TestEnum.ENUMVALUE, this.mocker.getComponentUnderTest() |
60 |
|
.convert(TestEnum.class, "ENUMVALUE")); |
61 |
|
} |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
63 |
1 |
@Test... |
64 |
|
public void testConvertColor() throws ComponentLookupException |
65 |
|
{ |
66 |
1 |
Assert.assertEquals(Color.WHITE, this.mocker.getComponentUnderTest().convert(Color.class, "#ffffff")); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
69 |
1 |
@Test(expected = ConversionException.class)... |
70 |
|
public void testConvertUnsupportedType() throws ComponentLookupException |
71 |
|
{ |
72 |
1 |
this.mocker.getComponentUnderTest().convert(DefaultConverterManagerTest.class, "#ffffff"); |
73 |
|
} |
74 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
75 |
1 |
@Test... |
76 |
|
public void testConvertSame() throws ComponentLookupException |
77 |
|
{ |
78 |
1 |
Assert.assertSame(Color.WHITE, this.mocker.getComponentUnderTest().convert(Color.class, Color.WHITE)); |
79 |
|
} |
80 |
|
} |