[MNG-7194] Test missing property evaluation (#1570)

Co-authored-by: Piotrek Żygieło <pzygielo@users.noreply.github.com>
This commit is contained in:
Piotrek Żygieło 2024-06-26 05:22:26 +02:00 committed by GitHub
parent 6e8550cd6a
commit 18f23a1dc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 40 additions and 0 deletions

View File

@ -266,6 +266,46 @@ public class PluginParameterExpressionEvaluatorTest extends AbstractCoreMavenCom
assertEquals("value", value);
}
public void testValueExtractionOfMissingPrefixedProperty() throws Exception {
Properties executionProperties = new Properties();
ExpressionEvaluator ee = createExpressionEvaluator(null, null, executionProperties);
Object value = ee.evaluate("prefix-${PPEET_nonexisting_p_property}");
assertEquals("prefix-${PPEET_nonexisting_p_property}", value);
}
public void testValueExtractionOfMissingSuffixedProperty() throws Exception {
Properties executionProperties = new Properties();
ExpressionEvaluator ee = createExpressionEvaluator(null, null, executionProperties);
Object value = ee.evaluate("${PPEET_nonexisting_s_property}-suffix");
assertEquals("${PPEET_nonexisting_s_property}-suffix", value);
}
public void testValueExtractionOfMissingPrefixedSuffixedProperty() throws Exception {
Properties executionProperties = new Properties();
ExpressionEvaluator ee = createExpressionEvaluator(null, null, executionProperties);
Object value = ee.evaluate("prefix-${PPEET_nonexisting_ps_property}-suffix");
assertEquals("prefix-${PPEET_nonexisting_ps_property}-suffix", value);
}
public void testValueExtractionOfMissingProperty() throws Exception {
Properties executionProperties = new Properties();
ExpressionEvaluator ee = createExpressionEvaluator(null, null, executionProperties);
Object value = ee.evaluate("${PPEET_nonexisting_property}");
assertNull(value);
}
public void testValueExtractionFromSystemPropertiesWithMissingProject_WithDotNotation() throws Exception {
String sysprop = "PPEET.sysprop2";