From 6af4c03ac82aefc517ffd19f85e6791657018cf2 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Mon, 30 Jun 2025 08:37:02 -0700 Subject: [PATCH] Handle newlines in release notes test (#130134) Newlines are system dependent. The release notes generator uses groovy's template engine, which produces system dependent newlines. This commit adjusts the test to account for newlines on both windows and nix systems. --- .../gradle/internal/release/ReleaseNotesGeneratorTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/release/ReleaseNotesGeneratorTest.java b/build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/release/ReleaseNotesGeneratorTest.java index cbb53698c586b..e60e46d6d3ac9 100644 --- a/build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/release/ReleaseNotesGeneratorTest.java +++ b/build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/release/ReleaseNotesGeneratorTest.java @@ -20,7 +20,7 @@ import java.util.Objects; import java.util.Set; -import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.arrayContaining; import static org.junit.Assert.assertThat; public class ReleaseNotesGeneratorTest { @@ -42,7 +42,10 @@ public void generateFile_rendersCorrectMarkup() throws Exception { final String actualOutput = ReleaseNotesGenerator.generateFile(template, QualifiedVersion.of("8.2.0-SNAPSHOT"), entries); // then: - assertThat(actualOutput, equalTo(expectedOutput)); + String[] expectedLines = expectedOutput.replace("\r", "").split("\n"); + String[] actualLines = actualOutput.split("\n"); + + assertThat(actualLines, arrayContaining(expectedLines)); } private Set getEntries() {