1 |
|
package org.europa.together.application; |
2 |
|
|
3 |
|
import static com.google.code.beanmatchers.BeanMatchers.*; |
4 |
|
import java.util.HashMap; |
5 |
|
import java.util.Map; |
6 |
|
import org.europa.together.JUnit5Preperator; |
7 |
|
import org.europa.together.business.Logger; |
8 |
|
import org.europa.together.business.PropertyReader; |
9 |
|
import org.europa.together.domain.LogLevel; |
10 |
|
import org.europa.together.utils.Constraints; |
11 |
|
import static org.hamcrest.MatcherAssert.assertThat; |
12 |
|
import org.junit.jupiter.api.AfterAll; |
13 |
|
import org.junit.jupiter.api.AfterEach; |
14 |
|
import static org.junit.jupiter.api.Assertions.*; |
15 |
|
import org.junit.jupiter.api.Assumptions; |
16 |
|
import org.junit.jupiter.api.BeforeAll; |
17 |
|
import org.junit.jupiter.api.BeforeEach; |
18 |
|
import org.junit.jupiter.api.Test; |
19 |
|
import org.junit.jupiter.api.extension.ExtendWith; |
20 |
|
import org.springframework.beans.factory.annotation.Autowired; |
21 |
|
import org.springframework.test.context.ContextConfiguration; |
22 |
|
import org.springframework.test.context.junit.jupiter.SpringExtension; |
23 |
|
|
24 |
|
@SuppressWarnings("unchecked") |
25 |
|
@ExtendWith({JUnit5Preperator.class}) |
26 |
|
@ExtendWith(SpringExtension.class) |
27 |
|
@ContextConfiguration(locations = {"/applicationContext.xml"}) |
|
|
| 100% |
Uncovered Elements: 0 (221) |
Complexity: 30 |
Complexity Density: 0.16 |
|
28 |
|
public class PropertyFileReaderTest { |
29 |
|
|
30 |
|
private static final Logger LOGGER |
31 |
|
= new LogbackLogger(PropertyFileReaderTest.class); |
32 |
|
|
33 |
|
private static final String FILE_PATH |
34 |
|
= "org/europa/together/properties/properties-test-classpath.properties"; |
35 |
|
private static final String DIRECTORY |
36 |
|
= Constraints.SYSTEM_APP_DIR + "/target/test-classes/" + FILE_PATH; |
37 |
|
|
38 |
|
@Autowired |
39 |
|
private PropertyReader propertyReader; |
40 |
|
|
41 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
42 |
1 |
@BeforeAll... |
43 |
|
static void setUp() { |
44 |
1 |
Assumptions.assumeTrue(true, "Assumtion failed."); |
45 |
|
|
46 |
1 |
LOGGER.log("Assumptions passed ...\n\n", LogLevel.DEBUG); |
47 |
|
} |
48 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
49 |
1 |
@AfterAll... |
50 |
|
static void tearDown() { |
51 |
|
} |
52 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
53 |
26 |
@BeforeEach... |
54 |
|
void testCaseInitialization() { |
55 |
|
} |
56 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
57 |
26 |
@AfterEach... |
58 |
|
void testCaseTermination() { |
59 |
|
} |
60 |
|
|
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
62 |
1 |
@Test... |
63 |
|
void constructor() { |
64 |
1 |
LOGGER.log("TEST CASE: constructor", LogLevel.DEBUG); |
65 |
|
|
66 |
1 |
assertThat(PropertyFileReader.class, hasValidBeanConstructor()); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
69 |
1 |
@Test... |
70 |
|
void addPropertyList() { |
71 |
1 |
LOGGER.log("TEST CASE: addPropertyList", LogLevel.DEBUG); |
72 |
|
|
73 |
1 |
propertyReader.clear(); |
74 |
1 |
assertEquals(0, propertyReader.count()); |
75 |
|
|
76 |
1 |
Map<String, String> resource = new HashMap<>(); |
77 |
1 |
resource.put("1", "1"); |
78 |
1 |
resource.put("2", "1"); |
79 |
1 |
resource.put("3", "1"); |
80 |
|
|
81 |
1 |
propertyReader.addPropertyList(resource); |
82 |
1 |
assertEquals(3, propertyReader.count()); |
83 |
|
} |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
85 |
1 |
@Test... |
86 |
|
void failAddEmptyPropertyList() { |
87 |
1 |
LOGGER.log("TEST CASE: failAddEmptyPropertyList", LogLevel.DEBUG); |
88 |
|
|
89 |
1 |
propertyReader.clear(); |
90 |
1 |
assertEquals(0, propertyReader.count()); |
91 |
|
|
92 |
1 |
Map<String, String> resource_01 = new HashMap<>(); |
93 |
1 |
resource_01.put("1", "1"); |
94 |
1 |
resource_01.put("2", "1"); |
95 |
|
|
96 |
1 |
Map<String, String> resource_02 = new HashMap<>(); |
97 |
|
|
98 |
1 |
assertTrue(propertyReader.addPropertyList(resource_01)); |
99 |
1 |
assertFalse(propertyReader.addPropertyList(resource_02)); |
100 |
|
|
101 |
1 |
assertEquals(2, propertyReader.count()); |
102 |
|
} |
103 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
104 |
1 |
@Test... |
105 |
|
void overwriteAddPropertyList() throws Exception { |
106 |
1 |
LOGGER.log("TEST CASE: overwriteAddPropertyList", LogLevel.DEBUG); |
107 |
|
|
108 |
1 |
propertyReader.clear(); |
109 |
1 |
assertEquals(0, propertyReader.count()); |
110 |
|
|
111 |
1 |
Map<String, String> resource = new HashMap<>(); |
112 |
1 |
resource.put("1", "1"); |
113 |
1 |
resource.put("2", "1"); |
114 |
1 |
resource.put("3", "1"); |
115 |
|
|
116 |
1 |
propertyReader.addPropertyList(resource); |
117 |
1 |
assertEquals(3, propertyReader.count()); |
118 |
|
|
119 |
1 |
resource.put("3", "8"); |
120 |
1 |
propertyReader.addPropertyList(resource); |
121 |
|
|
122 |
1 |
assertEquals(3, propertyReader.count()); |
123 |
1 |
assertEquals("8", propertyReader.getPropertyAsString("3")); |
124 |
|
} |
125 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
126 |
1 |
@Test... |
127 |
|
void appendPropertiesFromExternalFile() throws Exception { |
128 |
1 |
LOGGER.log("TEST CASE: appendPropertiesFromExternalFile", LogLevel.DEBUG); |
129 |
|
|
130 |
1 |
propertyReader.clear(); |
131 |
1 |
assertEquals(0, propertyReader.count()); |
132 |
|
|
133 |
1 |
propertyReader.appendPropertiesFromFile(DIRECTORY); |
134 |
1 |
assertEquals(35, propertyReader.count()); |
135 |
|
} |
136 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
137 |
1 |
@Test... |
138 |
|
void failAppendPropertiesFromExternalFile() throws Exception { |
139 |
1 |
LOGGER.log("TEST CASE: failAppendPropertiesFromExternalFile", LogLevel.DEBUG); |
140 |
|
|
141 |
1 |
propertyReader.clear(); |
142 |
1 |
assertThrows(Exception.class, () -> { |
143 |
1 |
propertyReader.appendPropertiesFromFile("NotExist"); |
144 |
|
}); |
145 |
|
} |
146 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
147 |
1 |
@Test... |
148 |
|
void appendPropertiesFromClasspath() throws Exception { |
149 |
1 |
LOGGER.log("TEST CASE: appendPropertiesFromClasspath", LogLevel.DEBUG); |
150 |
|
|
151 |
1 |
propertyReader.clear(); |
152 |
1 |
assertEquals(0, propertyReader.count()); |
153 |
|
|
154 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
155 |
1 |
assertEquals(35, propertyReader.count()); |
156 |
|
} |
157 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
158 |
1 |
@Test... |
159 |
|
void fileAppendPropertiesFromClasspath() throws Exception { |
160 |
1 |
LOGGER.log("TEST CASE: fileAppendPropertiesFromClasspath", LogLevel.DEBUG); |
161 |
|
|
162 |
1 |
propertyReader.clear(); |
163 |
1 |
assertThrows(Exception.class, () -> { |
164 |
1 |
propertyReader.appendPropertiesFromClasspath("NotExist"); |
165 |
|
}); |
166 |
|
} |
167 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
168 |
1 |
@Test... |
169 |
|
void getPropertyAsBoolean() throws Exception { |
170 |
1 |
LOGGER.log("TEST CASE: getPropertyAsBoolean", LogLevel.DEBUG); |
171 |
|
|
172 |
1 |
propertyReader.clear(); |
173 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
174 |
|
|
175 |
1 |
assertTrue(propertyReader.getPropertyAsBoolean("test.type.boolean.01")); |
176 |
1 |
assertFalse(propertyReader.getPropertyAsBoolean("test.type.boolean.02")); |
177 |
1 |
assertTrue(propertyReader.getPropertyAsBoolean("test.type.boolean.03")); |
178 |
1 |
assertFalse(propertyReader.getPropertyAsBoolean("test.type.boolean.04")); |
179 |
|
} |
180 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
181 |
1 |
@Test... |
182 |
|
void failGetPropertyAsBoolean() throws Exception { |
183 |
1 |
LOGGER.log("TEST CASE: failGetPropertyAsBoolean", LogLevel.DEBUG); |
184 |
|
|
185 |
1 |
propertyReader.clear(); |
186 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
187 |
|
|
188 |
1 |
assertThrows(Exception.class, () -> { |
189 |
1 |
assertNull(propertyReader.getPropertyAsBoolean("test.type.boolean.00")); |
190 |
|
}); |
191 |
1 |
assertThrows(Exception.class, () -> { |
192 |
1 |
assertNull(propertyReader.getPropertyAsBoolean("test.type.boolean.5")); |
193 |
|
}); |
194 |
1 |
assertThrows(Exception.class, () -> { |
195 |
1 |
assertNull(propertyReader.getPropertyAsBoolean("test.type.boolean.06")); |
196 |
|
}); |
197 |
1 |
assertThrows(Exception.class, () -> { |
198 |
1 |
assertNull(propertyReader.getPropertyAsBoolean("boolean")); |
199 |
|
}); |
200 |
|
} |
201 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
202 |
1 |
@Test... |
203 |
|
void getPropertyAsInt() throws Exception { |
204 |
1 |
LOGGER.log("TEST CASE: getPropertyAsInt", LogLevel.DEBUG); |
205 |
|
|
206 |
1 |
propertyReader.clear(); |
207 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
208 |
|
|
209 |
1 |
assertEquals(Integer.valueOf(-1), propertyReader.getPropertyAsInt("test.type.int.01")); |
210 |
1 |
assertEquals(Integer.valueOf(0), propertyReader.getPropertyAsInt("test.type.int.02")); |
211 |
1 |
assertEquals(Integer.valueOf(1), propertyReader.getPropertyAsInt("test.type.int.03")); |
212 |
|
} |
213 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
214 |
1 |
@Test... |
215 |
|
void failGetPropertyAsInt() throws Exception { |
216 |
1 |
LOGGER.log("TEST CASE: failGetPropertyAsInt", LogLevel.DEBUG); |
217 |
|
|
218 |
1 |
propertyReader.clear(); |
219 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
220 |
|
|
221 |
1 |
assertThrows(Exception.class, () -> { |
222 |
1 |
assertNull(propertyReader.getPropertyAsInt("test.type.int.00")); |
223 |
|
}); |
224 |
1 |
assertThrows(Exception.class, () -> { |
225 |
1 |
assertNull(propertyReader.getPropertyAsInt("test.type.int.04")); |
226 |
|
}); |
227 |
1 |
assertThrows(Exception.class, () -> { |
228 |
1 |
assertNull(propertyReader.getPropertyAsInt("test.type.int.05")); |
229 |
|
}); |
230 |
1 |
assertThrows(Exception.class, () -> { |
231 |
1 |
assertNull(propertyReader.getPropertyAsInt("test.type.int.06")); |
232 |
|
}); |
233 |
1 |
assertThrows(Exception.class, () -> { |
234 |
1 |
assertNull(propertyReader.getPropertyAsInt("integer")); |
235 |
|
}); |
236 |
|
} |
237 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
238 |
1 |
@Test... |
239 |
|
void getPropertyAsString() throws Exception { |
240 |
1 |
LOGGER.log("TEST CASE: getPropertyAsString", LogLevel.DEBUG); |
241 |
|
|
242 |
1 |
propertyReader.clear(); |
243 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
244 |
|
|
245 |
1 |
assertEquals("", propertyReader.getPropertyAsString("test.type.string.00")); |
246 |
1 |
assertEquals("string", propertyReader.getPropertyAsString("test.type.string.01")); |
247 |
1 |
assertEquals("1", propertyReader.getPropertyAsString("test.type.string.02")); |
248 |
1 |
assertEquals("@_001_string", propertyReader.getPropertyAsString("test.type.string.03")); |
249 |
|
} |
250 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
251 |
1 |
@Test... |
252 |
|
void failGetPropertyAsString() throws Exception { |
253 |
1 |
LOGGER.log("TEST CASE: failGetPropertyAsString", LogLevel.DEBUG); |
254 |
|
|
255 |
1 |
propertyReader.clear(); |
256 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
257 |
|
|
258 |
1 |
assertThrows(Exception.class, () -> { |
259 |
1 |
assertNull(propertyReader.getPropertyAsString("string")); |
260 |
|
}); |
261 |
|
} |
262 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
263 |
1 |
@Test... |
264 |
|
void getPropertyAsFloat() throws Exception { |
265 |
1 |
LOGGER.log("TEST CASE: getPropertyAsFloat", LogLevel.DEBUG); |
266 |
|
|
267 |
1 |
propertyReader.clear(); |
268 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
269 |
|
|
270 |
1 |
assertEquals(Float.valueOf(0), propertyReader.getPropertyAsFloat("test.type.float.01")); |
271 |
1 |
assertEquals(Float.valueOf(0), propertyReader.getPropertyAsFloat("test.type.float.02")); |
272 |
1 |
assertEquals(Float.valueOf("-1.123"), propertyReader.getPropertyAsFloat("test.type.float.03")); |
273 |
1 |
assertEquals(Float.valueOf("345.21"), propertyReader.getPropertyAsFloat("test.type.float.04")); |
274 |
1 |
assertEquals(Float.valueOf("13E12"), propertyReader.getPropertyAsFloat("test.type.float.05")); |
275 |
1 |
assertEquals(Float.valueOf("-8E5"), propertyReader.getPropertyAsFloat("test.type.float.06")); |
276 |
1 |
assertEquals(Float.valueOf("-8.012E7"), propertyReader.getPropertyAsFloat("test.type.float.07")); |
277 |
|
} |
278 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
279 |
1 |
@Test... |
280 |
|
void failGetPropertyAsFloat() throws Exception { |
281 |
1 |
LOGGER.log("TEST CASE: failGetPropertyAsFloat", LogLevel.DEBUG); |
282 |
|
|
283 |
1 |
propertyReader.clear(); |
284 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
285 |
|
|
286 |
1 |
assertThrows(Exception.class, () -> { |
287 |
1 |
propertyReader.getPropertyAsFloat("test.type.float.00"); |
288 |
|
}); |
289 |
1 |
assertThrows(Exception.class, () -> { |
290 |
1 |
propertyReader.getPropertyAsFloat("test.type.float.08"); |
291 |
|
}); |
292 |
1 |
assertThrows(Exception.class, () -> { |
293 |
1 |
propertyReader.getPropertyAsFloat("float"); |
294 |
|
}); |
295 |
1 |
assertThrows(Exception.class, () -> { |
296 |
1 |
propertyReader.getPropertyAsFloat("float"); |
297 |
|
}); |
298 |
|
} |
299 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
300 |
1 |
@Test... |
301 |
|
void getPropertyAsDouble() throws Exception { |
302 |
1 |
LOGGER.log("TEST CASE: getPropertyAsDouble", LogLevel.DEBUG); |
303 |
|
|
304 |
1 |
propertyReader.clear(); |
305 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
306 |
|
|
307 |
1 |
assertEquals(Double.valueOf(0), propertyReader.getPropertyAsDouble("test.type.double.01")); |
308 |
1 |
assertEquals(Double.valueOf(13E12), propertyReader.getPropertyAsDouble("test.type.double.02")); |
309 |
1 |
assertEquals(Double.valueOf(-8E5), propertyReader.getPropertyAsDouble("test.type.double.03")); |
310 |
1 |
assertEquals(Double.valueOf(-8.012E7), propertyReader.getPropertyAsDouble("test.type.double.04")); |
311 |
1 |
assertEquals(Double.valueOf(345.2132), propertyReader.getPropertyAsDouble("test.type.double.05")); |
312 |
|
} |
313 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
314 |
1 |
@Test... |
315 |
|
void failGetPropertyAsDouble() throws Exception { |
316 |
1 |
LOGGER.log("TEST CASE: failGetPropertyAsDouble", LogLevel.DEBUG); |
317 |
|
|
318 |
1 |
propertyReader.clear(); |
319 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
320 |
|
|
321 |
1 |
assertThrows(Exception.class, () -> { |
322 |
1 |
propertyReader.getPropertyAsDouble("test.type.double.00"); |
323 |
|
}); |
324 |
1 |
assertThrows(Exception.class, () -> { |
325 |
1 |
propertyReader.getPropertyAsDouble("test.type.double.06"); |
326 |
|
}); |
327 |
1 |
assertThrows(Exception.class, () -> { |
328 |
1 |
propertyReader.getPropertyAsDouble("double"); |
329 |
|
}); |
330 |
|
} |
331 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
332 |
1 |
@Test... |
333 |
|
void addProperty() throws Exception { |
334 |
1 |
LOGGER.log("TEST CASE: addProperty", LogLevel.DEBUG); |
335 |
|
|
336 |
1 |
propertyReader.clear(); |
337 |
1 |
assertEquals(0, propertyReader.count()); |
338 |
|
|
339 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
340 |
1 |
assertEquals(35, propertyReader.count()); |
341 |
|
|
342 |
1 |
assertTrue(propertyReader.addProperty("test", "testValue")); |
343 |
1 |
assertEquals(36, propertyReader.count()); |
344 |
1 |
assertEquals("testValue", propertyReader.getPropertyAsString("test")); |
345 |
|
} |
346 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
347 |
1 |
@Test... |
348 |
|
void failAddProperty() throws Exception { |
349 |
1 |
LOGGER.log("TEST CASE: failAddProperty", LogLevel.DEBUG); |
350 |
|
|
351 |
1 |
propertyReader.clear(); |
352 |
1 |
assertEquals(0, propertyReader.count()); |
353 |
|
|
354 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
355 |
|
|
356 |
1 |
assertFalse(propertyReader.addProperty("test.type.string.00", "overwrite")); |
357 |
1 |
assertEquals("", propertyReader.getPropertyAsString("test.type.string.00")); |
358 |
1 |
assertEquals(35, propertyReader.count()); |
359 |
|
} |
360 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
361 |
1 |
@Test... |
362 |
|
void removeProperty() throws Exception { |
363 |
1 |
LOGGER.log("TEST CASE: removeProperty", LogLevel.DEBUG); |
364 |
|
|
365 |
1 |
propertyReader.clear(); |
366 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
367 |
1 |
assertEquals(35, propertyReader.count()); |
368 |
|
|
369 |
1 |
assertFalse(propertyReader.removeProperty("propertyFile")); |
370 |
1 |
assertTrue(propertyReader.removeProperty("test.type.double.02")); |
371 |
1 |
assertEquals(34, propertyReader.count()); |
372 |
|
} |
373 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
374 |
1 |
@Test... |
375 |
|
void failRemoveProperty() throws Exception { |
376 |
1 |
LOGGER.log("TEST CASE: failRemoveProperty", LogLevel.DEBUG); |
377 |
|
|
378 |
1 |
propertyReader.clear(); |
379 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
380 |
|
|
381 |
1 |
assertFalse(propertyReader.removeProperty("NotExist")); |
382 |
1 |
assertEquals(35, propertyReader.count()); |
383 |
|
} |
384 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
385 |
1 |
@Test... |
386 |
|
void updateProperty() throws Exception { |
387 |
1 |
LOGGER.log("TEST CASE: updateProperty", LogLevel.DEBUG); |
388 |
|
|
389 |
1 |
propertyReader.clear(); |
390 |
1 |
propertyReader.addProperty("test_A", "Value_A"); |
391 |
1 |
propertyReader.addProperty("test_B", "Value_B"); |
392 |
|
|
393 |
1 |
assertTrue(propertyReader.updateProperty("test_A", "update_test_A")); |
394 |
1 |
assertTrue(propertyReader.updateProperty("test_B", "update_test_B")); |
395 |
|
|
396 |
1 |
assertEquals("update_test_A", propertyReader.getPropertyAsString("test_A")); |
397 |
1 |
assertEquals("update_test_B", propertyReader.getPropertyAsString("test_B")); |
398 |
|
|
399 |
1 |
assertEquals(2, propertyReader.count()); |
400 |
|
} |
401 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
402 |
1 |
@Test... |
403 |
|
void failUpdateProperty() { |
404 |
1 |
LOGGER.log("TEST CASE: failUpdateProperty", LogLevel.DEBUG); |
405 |
|
|
406 |
1 |
propertyReader.clear(); |
407 |
1 |
propertyReader.addProperty("test_A", "Value_A"); |
408 |
|
|
409 |
1 |
assertTrue(propertyReader.updateProperty("NotExist", "empty")); |
410 |
1 |
assertEquals(2, propertyReader.count()); |
411 |
|
} |
412 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
413 |
1 |
@Test... |
414 |
|
void clearProperties() throws Exception { |
415 |
1 |
LOGGER.log("TEST CASE: clearProperties", LogLevel.DEBUG); |
416 |
|
|
417 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
418 |
1 |
propertyReader.clear(); |
419 |
1 |
assertEquals(0, propertyReader.count()); |
420 |
|
} |
421 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
422 |
1 |
@Test... |
423 |
|
void getPropertyList() throws Exception { |
424 |
1 |
LOGGER.log("TEST CASE: getPropertyList", LogLevel.DEBUG); |
425 |
|
|
426 |
1 |
propertyReader.clear(); |
427 |
1 |
propertyReader.appendPropertiesFromClasspath(FILE_PATH); |
428 |
1 |
int listCount = propertyReader.getPropertyList().size(); |
429 |
1 |
assertEquals(listCount, propertyReader.count()); |
430 |
|
} |
431 |
|
} |