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