|
58 | 58 | import org.codehaus.plexus.configuration.DefaultPlexusConfiguration;
|
59 | 59 | import org.codehaus.plexus.util.Os;
|
60 | 60 | import org.junit.jupiter.api.Test;
|
| 61 | +import org.junit.jupiter.params.ParameterizedTest; |
| 62 | +import org.junit.jupiter.params.provider.ValueSource; |
61 | 63 |
|
62 | 64 | import static org.codehaus.plexus.testing.PlexusExtension.getTestFile;
|
63 | 65 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
@@ -291,6 +293,34 @@ void testValueExtractionFromSystemPropertiesWithMissingProject() throws Exceptio
|
291 | 293 | assertEquals("value", value);
|
292 | 294 | }
|
293 | 295 |
|
| 296 | + @ParameterizedTest |
| 297 | + @ValueSource( |
| 298 | + strings = { |
| 299 | + "prefix-${PPEET_nonexisting_ps_property}", |
| 300 | + "${PPEET_nonexisting_ps_property}-suffix", |
| 301 | + "prefix-${PPEET_nonexisting_ps_property}-suffix", |
| 302 | + }) |
| 303 | + void testValueExtractionOfMissingPrefixedSuffixedProperty(String missingPropertyExpression) throws Exception { |
| 304 | + Properties executionProperties = new Properties(); |
| 305 | + |
| 306 | + ExpressionEvaluator ee = createExpressionEvaluator(null, null, executionProperties); |
| 307 | + |
| 308 | + Object value = ee.evaluate(missingPropertyExpression); |
| 309 | + |
| 310 | + assertEquals(missingPropertyExpression, value); |
| 311 | + } |
| 312 | + |
| 313 | + @Test |
| 314 | + void testValueExtractionOfMissingProperty() throws Exception { |
| 315 | + Properties executionProperties = new Properties(); |
| 316 | + |
| 317 | + ExpressionEvaluator ee = createExpressionEvaluator(null, null, executionProperties); |
| 318 | + |
| 319 | + Object value = ee.evaluate("${PPEET_nonexisting_property}"); |
| 320 | + |
| 321 | + assertNull(value); |
| 322 | + } |
| 323 | + |
294 | 324 | @Test
|
295 | 325 | void testValueExtractionFromSystemPropertiesWithMissingProject_WithDotNotation() throws Exception {
|
296 | 326 | String sysprop = "PPEET.sysprop2";
|
|
0 commit comments