-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into renovate/major-query.…
…version
- Loading branch information
Showing
19 changed files
with
292 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
cucumber-core/src/test/java/io/cucumber/core/plugin/IsEqualCompressingLineSeparators.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package io.cucumber.core.plugin; | ||
|
||
import org.hamcrest.Description; | ||
import org.hamcrest.Matcher; | ||
import org.hamcrest.TypeSafeMatcher; | ||
|
||
import java.util.Objects; | ||
|
||
public class IsEqualCompressingLineSeparators extends TypeSafeMatcher<String> { | ||
|
||
private final String expected; | ||
|
||
public IsEqualCompressingLineSeparators(String expected) { | ||
Objects.requireNonNull(expected); | ||
this.expected = expected; | ||
} | ||
|
||
public String getExpected() { | ||
return expected; | ||
} | ||
|
||
@Override | ||
public boolean matchesSafely(String actual) { | ||
return compressNewLines(expected).equals(compressNewLines(actual)); | ||
} | ||
|
||
@Override | ||
public void describeMismatchSafely(String item, Description mismatchDescription) { | ||
mismatchDescription.appendText("was ").appendValue(item); | ||
} | ||
|
||
@Override | ||
public void describeTo(Description description) { | ||
description.appendText("a string equal to ") | ||
.appendValue(expected) | ||
.appendText(" compressing newlines"); | ||
} | ||
|
||
public String compressNewLines(String actual) { | ||
return actual.replaceAll("[\r\n]+", "\n").trim(); | ||
} | ||
|
||
public static Matcher<String> equalCompressingLineSeparators(String expectedString) { | ||
return new IsEqualCompressingLineSeparators(expectedString); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.