Skip to content

Fix test to allow Git origin URLs starting with git@ #4152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.regex.Pattern;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
Expand Down Expand Up @@ -75,9 +76,9 @@ void writesValidXmlReport() throws Exception {
<java:javaVersion>${xmlunit.ignore}</java:javaVersion>
<java:fileEncoding>${xmlunit.ignore}</java:fileEncoding>
<java:heapSize max="${xmlunit.isNumber}"/>
<git:repository originUrl="${xmlunit.matchesRegex(https://.+)}"/>
<git:repository originUrl="${xmlunit.matchesRegex#(git@|https://).+#}"/>
<git:branch>${xmlunit.ignore}</git:branch>
<git:commit>${xmlunit.matchesRegex([0-9a-f]{40})}</git:commit>
<git:commit>${xmlunit.matchesRegex#[0-9a-f]{40}#}</git:commit>
<git:status clean="${xmlunit.ignore}">${xmlunit.ignore}</git:status>
</infrastructure>
<e:started id="1" name="dummy" time="${xmlunit.isDateTime}">
Expand All @@ -104,7 +105,7 @@ void writesValidXmlReport() throws Exception {
<e:finished id="2" time="${xmlunit.isDateTime}">
<result status="FAILED">
<java:throwable assertionError="true" type="org.opentest4j.AssertionFailedError">
${xmlunit.matchesRegex(org\\.opentest4j\\.AssertionFailedError: failure message)}
${xmlunit.matchesRegex#org\\.opentest4j\\.AssertionFailedError: failure message#}
</java:throwable>
</result>
</e:finished>
Expand All @@ -115,7 +116,8 @@ void writesValidXmlReport() throws Exception {
""";

XmlAssert.assertThat(xmlFile).and(expected) //
.withDifferenceEvaluator(new PlaceholderDifferenceEvaluator()) //
.withDifferenceEvaluator(new PlaceholderDifferenceEvaluator(Pattern.quote("${"), Pattern.quote("}"),
Pattern.quote("#"), Pattern.quote("#"), ",")) //
.ignoreWhitespace() //
.areIdentical();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.regex.Pattern;

import org.xmlunit.assertj3.XmlAssert;
import org.xmlunit.placeholder.PlaceholderDifferenceEvaluator;
Expand Down Expand Up @@ -46,9 +47,9 @@ private static void verifyContent(Path xmlFile) {
<java:javaVersion>${xmlunit.ignore}</java:javaVersion>
<java:fileEncoding>${xmlunit.ignore}</java:fileEncoding>
<java:heapSize max="${xmlunit.isNumber}"/>
<git:repository originUrl="${xmlunit.matchesRegex(https://.+)}"/>
<git:repository originUrl="${xmlunit.matchesRegex#(git@|https://).+#}"/>
<git:branch>${xmlunit.ignore}</git:branch>
<git:commit>${xmlunit.matchesRegex([0-9a-f]{40})}</git:commit>
<git:commit>${xmlunit.matchesRegex#[0-9a-f]{40}#}</git:commit>
<git:status clean="${xmlunit.ignore}">${xmlunit.ignore}</git:status>
</infrastructure>
<e:started id="1" name="JUnit Jupiter" time="${xmlunit.isDateTime}">
Expand Down Expand Up @@ -156,7 +157,8 @@ private static void verifyContent(Path xmlFile) {
""";

XmlAssert.assertThat(xmlFile).and(expected) //
.withDifferenceEvaluator(new PlaceholderDifferenceEvaluator()) //
.withDifferenceEvaluator(new PlaceholderDifferenceEvaluator(Pattern.quote("${"), Pattern.quote("}"),
Pattern.quote("#"), Pattern.quote("#"), ",")) //
.ignoreWhitespace() //
.areIdentical();
}
Expand Down