From c134710a7a05cfec1a9368eb4e25e9b4aeb08851 Mon Sep 17 00:00:00 2001 From: Harmen Wessels <97173058+harmen-xb@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:54:01 +0100 Subject: [PATCH] Updated Steps to always have CRLF for inline Cucumber content (and not otherwise). --- .../xml/test/PowerDeComposerTestSteps.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/PowerDeComposer/src/test/java/com/xbreeze/xml/test/PowerDeComposerTestSteps.java b/PowerDeComposer/src/test/java/com/xbreeze/xml/test/PowerDeComposerTestSteps.java index 6268b36..ff1e280 100644 --- a/PowerDeComposer/src/test/java/com/xbreeze/xml/test/PowerDeComposerTestSteps.java +++ b/PowerDeComposer/src/test/java/com/xbreeze/xml/test/PowerDeComposerTestSteps.java @@ -218,13 +218,13 @@ public void iExecuteDecompose() throws Throwable { @Then("^I expect a composed file '(.*)' with the following content:$") public void thenIExpectComposedFileWithFollowingContent(String composedFileLocation, String expectedComposedFileContents) throws Throwable { - thenIExpectTheFileWithFollowingContent(this._composedFolderPath.resolve(composedFileLocation).toFile(), expectedComposedFileContents); + thenIExpectTheFileWithContentFromCucumber(this._composedFolderPath.resolve(composedFileLocation).toFile(), expectedComposedFileContents); } @Then("^I expect a composed file with the following content:$") public void thenIExpectComposedFileWithFollowingContent(String expectedComposedFileContents) throws Throwable { - thenIExpectTheFileWithFollowingContent(this._composedFilePath.toFile(), expectedComposedFileContents); + thenIExpectTheFileWithContentFromCucumber(this._composedFilePath.toFile(), expectedComposedFileContents); } @Then("^I expect a composed file with the content equal to '(.*)'$") @@ -232,24 +232,29 @@ public void thenIExpectComposedFileWithContentEqualToFile(String expectedCompose throws Throwable { File expectedComposedFile = this._scenarioResourcePath.resolve(expectedComposedFileLocation).toFile(); String expectedComposedFileContents = PowerDeComposerTestSteps.getFileContents(expectedComposedFile); - thenIExpectTheFileWithFollowingContent(this._composedFilePath.toFile(), expectedComposedFileContents); + thenIExpectTheFileWithContents(this._composedFilePath.toFile(), expectedComposedFileContents); } @Then("^I expect a decomposed file '(.*)' with the following content:$") public void thenIExpectDecomposedFileWithFollowingContent(String decomposedFileLocation, String expectedDecomposedFileContents) throws Throwable { - thenIExpectTheFileWithFollowingContent(this._decomposedFolderPath.resolve(decomposedFileLocation).toFile(), expectedDecomposedFileContents); + thenIExpectTheFileWithContentFromCucumber(this._decomposedFolderPath.resolve(decomposedFileLocation).toFile(), expectedDecomposedFileContents); } @Then("^I expect a decomposed file with the following content:$") public void thenIExpectDecomposedFileWithFollowingContent(String expectedDecomposedFileContents) throws Throwable { - thenIExpectTheFileWithFollowingContent(this._decomposedFilePath.toFile(), expectedDecomposedFileContents); + thenIExpectTheFileWithContentFromCucumber(this._decomposedFilePath.toFile(), expectedDecomposedFileContents); } // Compare the actual and expected file contents. If it differs throw an assertion error. - public void thenIExpectTheFileWithFollowingContent(File targetFile, String expectedFileContents) + public void thenIExpectTheFileWithContentFromCucumber(File targetFile, String expectedFileContents) throws Throwable { + // If the file contents is written in Cucumber, the CR is removed, so we need to restore it here. + thenIExpectTheFileWithContents(targetFile, expectedFileContents.replaceAll("(?