mirror of https://github.com/apache/maven.git
[MNG-7194] Test missing property evaluation (#1573)
Co-authored-by: Piotrek Żygieło <pzygielo@users.noreply.github.com>
This commit is contained in:
parent
5b4e17736b
commit
57fd0dc69b
|
@ -58,6 +58,8 @@ import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator
|
||||||
import org.codehaus.plexus.configuration.DefaultPlexusConfiguration;
|
import org.codehaus.plexus.configuration.DefaultPlexusConfiguration;
|
||||||
import org.codehaus.plexus.util.Os;
|
import org.codehaus.plexus.util.Os;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
|
||||||
import static org.codehaus.plexus.testing.PlexusExtension.getTestFile;
|
import static org.codehaus.plexus.testing.PlexusExtension.getTestFile;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
@ -291,6 +293,34 @@ class PluginParameterExpressionEvaluatorTest extends AbstractCoreMavenComponentT
|
||||||
assertEquals("value", value);
|
assertEquals("value", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ParameterizedTest
|
||||||
|
@ValueSource(
|
||||||
|
strings = {
|
||||||
|
"prefix-${PPEET_nonexisting_ps_property}",
|
||||||
|
"${PPEET_nonexisting_ps_property}-suffix",
|
||||||
|
"prefix-${PPEET_nonexisting_ps_property}-suffix",
|
||||||
|
})
|
||||||
|
void testValueExtractionOfMissingPrefixedSuffixedProperty(String missingPropertyExpression) throws Exception {
|
||||||
|
Properties executionProperties = new Properties();
|
||||||
|
|
||||||
|
ExpressionEvaluator ee = createExpressionEvaluator(null, null, executionProperties);
|
||||||
|
|
||||||
|
Object value = ee.evaluate(missingPropertyExpression);
|
||||||
|
|
||||||
|
assertEquals(missingPropertyExpression, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testValueExtractionOfMissingProperty() throws Exception {
|
||||||
|
Properties executionProperties = new Properties();
|
||||||
|
|
||||||
|
ExpressionEvaluator ee = createExpressionEvaluator(null, null, executionProperties);
|
||||||
|
|
||||||
|
Object value = ee.evaluate("${PPEET_nonexisting_property}");
|
||||||
|
|
||||||
|
assertNull(value);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testValueExtractionFromSystemPropertiesWithMissingProject_WithDotNotation() throws Exception {
|
void testValueExtractionFromSystemPropertiesWithMissingProject_WithDotNotation() throws Exception {
|
||||||
String sysprop = "PPEET.sysprop2";
|
String sysprop = "PPEET.sysprop2";
|
||||||
|
|
Loading…
Reference in New Issue