| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
package org.apache.commons.beanutils.locale.converters; |
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
@author |
| 25 |
|
@version |
| 26 |
|
|
| 27 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (70) |
Complexity: 12 |
Complexity Density: 0.21 |
|
| 28 |
|
public class DoubleLocaleConverterTestCase extends BaseLocaleConverterTestCase { |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 34 |
10
|
public DoubleLocaleConverterTestCase(String name) {... |
| 35 |
10
|
super(name); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 43 |
10
|
public void setUp() throws Exception {... |
| 44 |
|
|
| 45 |
10
|
super.setUp(); |
| 46 |
|
|
| 47 |
10
|
defaultValue = new Double("9.99"); |
| 48 |
10
|
expectedValue = new Double(expectedDecimalValue); |
| 49 |
|
|
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 55 |
10
|
public void tearDown() {... |
| 56 |
10
|
super.tearDown(); |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
|
| 64 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1
PASS
|
|
| 65 |
1
|
public void testConstructorMain() {... |
| 66 |
|
|
| 67 |
|
|
| 68 |
1
|
converter = new DoubleLocaleConverter(defaultValue, |
| 69 |
|
localizedLocale, |
| 70 |
|
localizedDecimalPattern, |
| 71 |
|
true); |
| 72 |
|
|
| 73 |
|
|
| 74 |
1
|
convertValueNoPattern(converter, "(A)", localizedDecimalValue, expectedValue); |
| 75 |
1
|
convertValueWithPattern(converter, "(A)", localizedDecimalValue, localizedDecimalPattern, expectedValue); |
| 76 |
1
|
convertInvalid(converter, "(A)", defaultValue); |
| 77 |
1
|
convertNull(converter, "(A)", defaultValue); |
| 78 |
|
|
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| 84 |
|
|
| 85 |
|
|
| 86 |
1
|
convertValueNoPattern(converter, "(B)", defaultDecimalValue, new Double("1.234")); |
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
1
|
convertValueWithPattern(converter, "(B)", localizedDecimalValue, defaultDecimalPattern, defaultValue); |
| 97 |
|
|
| 98 |
|
|
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 104 |
|
|
| 105 |
|
|
| 106 |
1
|
convertValueToType(converter, "(B)", Integer.class, localizedDecimalValue, localizedDecimalPattern, expectedValue); |
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
1
|
converter = new DoubleLocaleConverter(defaultValue, |
| 111 |
|
localizedLocale, |
| 112 |
|
defaultDecimalPattern, |
| 113 |
|
false); |
| 114 |
|
|
| 115 |
|
|
| 116 |
1
|
convertValueNoPattern(converter, "(C)", localizedDecimalValue, expectedValue); |
| 117 |
1
|
convertValueWithPattern(converter, "(C)", localizedDecimalValue, defaultDecimalPattern, expectedValue); |
| 118 |
1
|
convertInvalid(converter, "(C)", defaultValue); |
| 119 |
1
|
convertNull(converter, "(C)", defaultValue); |
| 120 |
|
|
| 121 |
|
} |
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| 125 |
|
|
| 126 |
|
|
| 127 |
|
|
| 128 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
| 129 |
1
|
public void testConstructor_2() {... |
| 130 |
|
|
| 131 |
|
|
| 132 |
1
|
converter = new DoubleLocaleConverter(); |
| 133 |
|
|
| 134 |
|
|
| 135 |
1
|
convertValueNoPattern(converter, defaultDecimalValue, expectedValue); |
| 136 |
1
|
convertValueWithPattern(converter, defaultDecimalValue, defaultDecimalPattern, expectedValue); |
| 137 |
1
|
convertInvalid(converter, null); |
| 138 |
1
|
convertNull(converter, null); |
| 139 |
|
|
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
|
| 143 |
|
|
| 144 |
|
|
| 145 |
|
|
| 146 |
|
|
| 147 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
| 148 |
1
|
public void testConstructor_3() {... |
| 149 |
|
|
| 150 |
|
|
| 151 |
1
|
converter = new DoubleLocaleConverter(true); |
| 152 |
|
|
| 153 |
|
|
| 154 |
1
|
convertValueNoPattern(converter, defaultDecimalValue, expectedValue); |
| 155 |
1
|
convertValueWithPattern(converter, defaultDecimalValue, defaultDecimalPattern, expectedValue); |
| 156 |
1
|
convertInvalid(converter, null); |
| 157 |
1
|
convertNull(converter, null); |
| 158 |
|
|
| 159 |
|
|
| 160 |
|
} |
| 161 |
|
|
| 162 |
|
|
| 163 |
|
|
| 164 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
| 165 |
1
|
public void testConstructor_4() {... |
| 166 |
|
|
| 167 |
|
|
| 168 |
1
|
converter = new DoubleLocaleConverter(localizedLocale); |
| 169 |
|
|
| 170 |
|
|
| 171 |
1
|
convertValueNoPattern(converter, localizedDecimalValue, expectedValue); |
| 172 |
1
|
convertValueWithPattern(converter, localizedDecimalValue, defaultDecimalPattern, expectedValue); |
| 173 |
1
|
convertInvalid(converter, null); |
| 174 |
1
|
convertNull(converter, null); |
| 175 |
|
|
| 176 |
|
|
| 177 |
|
} |
| 178 |
|
|
| 179 |
|
|
| 180 |
|
|
| 181 |
|
|
| 182 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
| 183 |
1
|
public void testConstructor_5() {... |
| 184 |
|
|
| 185 |
|
|
| 186 |
1
|
converter = new DoubleLocaleConverter(localizedLocale, true); |
| 187 |
|
|
| 188 |
|
|
| 189 |
1
|
convertValueNoPattern(converter, localizedDecimalValue, expectedValue); |
| 190 |
1
|
convertValueWithPattern(converter, localizedDecimalValue, localizedDecimalPattern, expectedValue); |
| 191 |
1
|
convertInvalid(converter, null); |
| 192 |
1
|
convertNull(converter, null); |
| 193 |
|
|
| 194 |
|
|
| 195 |
|
} |
| 196 |
|
|
| 197 |
|
|
| 198 |
|
|
| 199 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
| 200 |
1
|
public void testConstructor_6() {... |
| 201 |
|
|
| 202 |
|
|
| 203 |
1
|
converter = new DoubleLocaleConverter(localizedLocale, defaultDecimalPattern); |
| 204 |
|
|
| 205 |
|
|
| 206 |
1
|
convertValueNoPattern(converter, localizedDecimalValue, expectedValue); |
| 207 |
1
|
convertValueWithPattern(converter, localizedDecimalValue, defaultDecimalPattern, expectedValue); |
| 208 |
1
|
convertInvalid(converter, null); |
| 209 |
1
|
convertNull(converter, null); |
| 210 |
|
|
| 211 |
|
} |
| 212 |
|
|
| 213 |
|
|
| 214 |
|
|
| 215 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
| 216 |
1
|
public void testConstructor_7() {... |
| 217 |
|
|
| 218 |
|
|
| 219 |
1
|
converter = new DoubleLocaleConverter(localizedLocale, localizedDecimalPattern, true); |
| 220 |
|
|
| 221 |
|
|
| 222 |
1
|
convertValueNoPattern(converter, localizedDecimalValue, expectedValue); |
| 223 |
1
|
convertValueWithPattern(converter, localizedDecimalValue, localizedDecimalPattern, expectedValue); |
| 224 |
1
|
convertInvalid(converter, null); |
| 225 |
1
|
convertNull(converter, null); |
| 226 |
|
|
| 227 |
|
} |
| 228 |
|
|
| 229 |
|
|
| 230 |
|
|
| 231 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
| 232 |
1
|
public void testConstructor_8() {... |
| 233 |
|
|
| 234 |
|
|
| 235 |
1
|
converter = new DoubleLocaleConverter(defaultValue); |
| 236 |
|
|
| 237 |
|
|
| 238 |
1
|
convertValueNoPattern(converter, defaultDecimalValue, expectedValue); |
| 239 |
1
|
convertValueWithPattern(converter, defaultDecimalValue, defaultDecimalPattern, expectedValue); |
| 240 |
1
|
convertInvalid(converter, defaultValue); |
| 241 |
1
|
convertNull(converter, defaultValue); |
| 242 |
|
|
| 243 |
|
} |
| 244 |
|
|
| 245 |
|
|
| 246 |
|
|
| 247 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
| 248 |
1
|
public void testConstructor_9() {... |
| 249 |
|
|
| 250 |
|
|
| 251 |
1
|
converter = new DoubleLocaleConverter(defaultValue, true); |
| 252 |
|
|
| 253 |
|
|
| 254 |
1
|
convertValueNoPattern(converter, defaultDecimalValue, expectedValue); |
| 255 |
1
|
convertValueWithPattern(converter, defaultDecimalValue, defaultDecimalPattern, expectedValue); |
| 256 |
1
|
convertInvalid(converter, defaultValue); |
| 257 |
1
|
convertNull(converter, defaultValue); |
| 258 |
|
|
| 259 |
|
} |
| 260 |
|
|
| 261 |
|
|
| 262 |
|
|
| 263 |
|
} |
| 264 |
|
|