diff --git a/core/citrus-base/src/main/java/org/citrusframework/variable/dictionary/AbstractDataDictionary.java b/core/citrus-base/src/main/java/org/citrusframework/variable/dictionary/AbstractDataDictionary.java index 3b7d0bad1a..2d70fefcee 100644 --- a/core/citrus-base/src/main/java/org/citrusframework/variable/dictionary/AbstractDataDictionary.java +++ b/core/citrus-base/src/main/java/org/citrusframework/variable/dictionary/AbstractDataDictionary.java @@ -77,7 +77,7 @@ public void initialize() { Properties props = new Properties(); try (InputStream inputStream = mappingFile.getInputStream()) { - if (mappingFile.getFile().getName().endsWith(".xml")) { + if (mappingFile.getLocation().endsWith(".xml")) { props.loadFromXML(inputStream); } else { props.load(inputStream); diff --git a/core/citrus-base/src/test/java/org/citrusframework/variable/dictionary/AbstractDataDictionaryTest.java b/core/citrus-base/src/test/java/org/citrusframework/variable/dictionary/AbstractDataDictionaryTest.java index 7f31bc2282..deb21f9bc6 100644 --- a/core/citrus-base/src/test/java/org/citrusframework/variable/dictionary/AbstractDataDictionaryTest.java +++ b/core/citrus-base/src/test/java/org/citrusframework/variable/dictionary/AbstractDataDictionaryTest.java @@ -11,7 +11,6 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.io.File; import java.io.InputStream; import java.util.InvalidPropertiesFormatException; @@ -48,7 +47,7 @@ public void testInitializeWithNormalPropertiesFile() { // Setup mock resource doReturn(inputStream).when(mappingFile).getInputStream(); - doReturn(new File("test.properties")).when(mappingFile).getFile(); + doReturn("test.properties").when(mappingFile).getLocation(); fixture.initialize(); @@ -69,7 +68,7 @@ public void testInitializeWithXMLPropertiesFile() { // Setup mock resource doReturn(inputStream).when(mappingFile).getInputStream(); - doReturn(new File("test.properties.xml")).when(mappingFile).getFile(); // Note the .xml-suffix + doReturn("test.properties.xml").when(mappingFile).getLocation(); // Note the .xml-suffix fixture.initialize(); @@ -83,7 +82,7 @@ public void testInitializeThrowsExceptionWithInvalidXMLPropertiesFile() { // Setup mock resource doReturn(inputStream).when(mappingFile).getInputStream(); - doReturn(new File("test.properties.xml")).when(mappingFile).getFile(); // Note the .xml-suffix + doReturn("test.properties.xml").when(mappingFile).getLocation(); // Note the .xml-suffix CitrusRuntimeException exception = expectThrows(CitrusRuntimeException.class, () -> fixture.initialize()); assertTrue(exception.getCause() instanceof InvalidPropertiesFormatException);