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.util.Arrays; |
23 |
|
import java.util.HashSet; |
24 |
|
import java.util.LinkedHashSet; |
25 |
|
|
26 |
|
import org.junit.Assert; |
27 |
|
import org.junit.Before; |
28 |
|
import org.junit.Test; |
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 (8) |
Complexity: 3 |
Complexity Density: 0.6 |
|
37 |
|
public class LinkedHashSetConverterTest 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 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
50 |
1 |
@Test... |
51 |
|
public void testConvertToString() |
52 |
|
{ |
53 |
1 |
Assert.assertEquals("1, 2, 3", |
54 |
|
this.converterManager.convert(String.class, new LinkedHashSet<String>(Arrays.asList("1", "2", "3")))); |
55 |
|
} |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
57 |
1 |
@Test... |
58 |
|
public void testConvertFromLinkedHashSet() |
59 |
|
{ |
60 |
1 |
HashSet<String> expect = new LinkedHashSet<String>(Arrays.asList("1", "2", "3")); |
61 |
|
|
62 |
1 |
Assert.assertSame(expect, this.converterManager.convert(LinkedHashSet.class, expect)); |
63 |
|
} |
64 |
|
} |