1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.objects.classes; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
|
24 |
|
import org.junit.Assert; |
25 |
|
import org.junit.Test; |
26 |
|
|
27 |
|
|
28 |
|
@link |
29 |
|
|
30 |
|
@version |
31 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 10 |
Complexity Density: 1 |
|
32 |
|
public class ListClassTest |
33 |
|
{ |
34 |
|
|
35 |
|
@link |
36 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
37 |
1 |
@Test... |
38 |
|
public void testGetListFromStringDefaultSeparator() |
39 |
|
{ |
40 |
1 |
Assert.assertEquals(Arrays.asList("a", "b", "c"), ListClass.getListFromString("a|b|c")); |
41 |
|
} |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
46 |
1 |
@Test... |
47 |
|
public void testGetListFromStringSeparatorInValues() |
48 |
|
{ |
49 |
1 |
Assert.assertEquals(Arrays.asList("a", "|b", "c|", "|"), ListClass.getListFromString("a|\\|b|c\\||\\|")); |
50 |
|
} |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
55 |
1 |
@Test... |
56 |
|
public void testGetListFromStringNonDefaultSeparator() |
57 |
|
{ |
58 |
1 |
Assert.assertEquals(Arrays.asList("a", "b", "c"), ListClass.getListFromString("a*b*c", "*", false)); |
59 |
|
} |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
64 |
1 |
@Test... |
65 |
|
public void testGetListFromStringMultipleSeparators() |
66 |
|
{ |
67 |
1 |
Assert.assertEquals(Arrays.asList("a", "b", "c", "d", "e"), |
68 |
|
ListClass.getListFromString("a*b,c,d*e", "*,", false)); |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
74 |
1 |
@Test... |
75 |
|
public void testGetListFromStringMultipleSeparatorsWithSeparatorsInValues() |
76 |
|
{ |
77 |
1 |
Assert.assertEquals(Arrays.asList("a*b", "c,d", "e*f"), |
78 |
|
ListClass.getListFromString("a\\*b,c\\,d*e\\*f", "*,", false)); |
79 |
|
} |
80 |
|
|
81 |
|
|
82 |
|
@link |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
84 |
1 |
@Test... |
85 |
|
public void testGetStringFromListDefaultSeparator() |
86 |
|
{ |
87 |
1 |
Assert.assertEquals("a|b|c", ListClass.getStringFromList(Arrays.asList("a", "b", "c"))); |
88 |
|
} |
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
93 |
1 |
@Test... |
94 |
|
public void testGetStringFromListSeparatorInValues() |
95 |
|
{ |
96 |
1 |
Assert.assertEquals("a|\\|b|c\\||\\|", ListClass.getStringFromList(Arrays.asList("a", "|b", "c|", "|"))); |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
102 |
1 |
@Test... |
103 |
|
public void testGetStringFromListNonDefaultSeparator() |
104 |
|
{ |
105 |
1 |
Assert.assertEquals("a*b*c", ListClass.getStringFromList(Arrays.asList("a", "b", "c"), "*")); |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
111 |
1 |
@Test... |
112 |
|
public void testGetStringFromListMultipleSeparators() |
113 |
|
{ |
114 |
1 |
Assert.assertEquals("a*b*c*d*e", ListClass.getStringFromList(Arrays.asList("a", "b", "c", "d", "e"), "*,")); |
115 |
|
} |
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
120 |
1 |
@Test... |
121 |
|
public void testGetStringFromListMultipleSeparatorsWithSeparatorsInValues() |
122 |
|
{ |
123 |
1 |
Assert.assertEquals("a\\*b*c\\,d*e\\*f", ListClass.getStringFromList(Arrays.asList("a*b", "c,d", "e*f"), "*,")); |
124 |
|
} |
125 |
|
} |