diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java index af01dac0283b..a9a537a4043d 100644 --- a/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/cmd/TestCommandTest.java @@ -30,6 +30,7 @@ import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import org.wso2.ballerinalang.util.RepoUtils; import picocli.CommandLine; import java.io.File; @@ -277,8 +278,9 @@ public void testBalTestWithStickyFlag() throws IOException { String buildLog = readOutput(true); Assert.assertEquals(buildLog.replaceAll("\r", ""), getOutput("bal-test-project.txt")); Assert.assertTrue(projectPath.resolve(DEPENDENCIES_TOML).toFile().exists()); - Assert.assertEquals(readFileAsString(projectPath.resolve(DEPENDENCIES_TOML)).trim(), readFileAsString( - projectPath.resolve(RESOURCE_DIR_NAME).resolve("expectedDeps.toml")).trim()); + Assert.assertEquals(readFileAsString(projectPath.resolve(DEPENDENCIES_TOML)).trim(), + readFileAsString(projectPath.resolve(RESOURCE_DIR_NAME).resolve("expectedDeps.toml")) + .trim().replace("INSERT_VERSION_HERE", RepoUtils.getBallerinaShortVersion())); // remove build file Files.deleteIfExists(projectPath.resolve(TARGET_DIR_NAME).resolve(BUILD_FILE)); @@ -294,8 +296,9 @@ public void testBalTestWithStickyFlag() throws IOException { String secondBuildLog = readOutput(true); Assert.assertEquals(secondBuildLog.replaceAll("\r", ""), getOutput("bal-test-project.txt")); Assert.assertTrue(projectPath.resolve(DEPENDENCIES_TOML).toFile().exists()); - Assert.assertEquals(readFileAsString(projectPath.resolve(DEPENDENCIES_TOML)).trim(), readFileAsString( - projectPath.resolve(RESOURCE_DIR_NAME).resolve("expectedDeps.toml")).trim()); + Assert.assertEquals(readFileAsString(projectPath.resolve(DEPENDENCIES_TOML)).trim(), + readFileAsString(projectPath.resolve(RESOURCE_DIR_NAME).resolve("expectedDeps.toml")) + .trim().replace("INSERT_VERSION_HERE", RepoUtils.getBallerinaShortVersion())); } @Test(description = "Test a ballerina project with the flag dump-graph") diff --git a/cli/ballerina-cli/src/test/resources/test-resources/balTestWithStickyFlag/project_b_100/resources/expectedDeps.toml b/cli/ballerina-cli/src/test/resources/test-resources/balTestWithStickyFlag/project_b_100/resources/expectedDeps.toml index cf1fc2d02a2e..9aa444443339 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/balTestWithStickyFlag/project_b_100/resources/expectedDeps.toml +++ b/cli/ballerina-cli/src/test/resources/test-resources/balTestWithStickyFlag/project_b_100/resources/expectedDeps.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.8.0-SNAPSHOT" +distribution-version = "INSERT_VERSION_HERE" [[package]] org = "ballerina"