Skip to content

Commit 6259034

Browse files
committed
Tidying up string matchers. All factory methods in MatchStrings
1 parent 0e93dbe commit 6259034

File tree

3 files changed

+2
-37
lines changed

3 files changed

+2
-37
lines changed

hamcrest-library/src/main/java/org/hamcrest/Matchers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> lessTh
12191219
* @param expectedString the expected value of matched strings
12201220
*/
12211221
public static org.hamcrest.Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString) {
1222-
return org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase(expectedString);
1222+
return MatchStrings.equalToIgnoringCase(expectedString);
12231223
}
12241224

12251225
/**
@@ -1236,7 +1236,7 @@ public static org.hamcrest.Matcher<java.lang.String> equalToIgnoringCase(java.la
12361236
* @param expectedString the expected value of matched strings
12371237
*/
12381238
public static org.hamcrest.Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString) {
1239-
return org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(expectedString);
1239+
return MatchStrings.equalToIgnoringWhiteSpace(expectedString);
12401240
}
12411241

12421242
/**

hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringCase.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package org.hamcrest.text;
44

55
import org.hamcrest.Description;
6-
import org.hamcrest.Matcher;
76
import org.hamcrest.TypeSafeMatcher;
87

98
/**
@@ -34,18 +33,4 @@ public void describeTo(Description description) {
3433
.appendValue(string)
3534
.appendText(")");
3635
}
37-
38-
/**
39-
* Creates a matcher of {@link String} that matches when the examined string is equal to
40-
* the specified expectedString, ignoring case.
41-
* For example:
42-
* <pre>assertThat("Foo", equalToIgnoringCase("FOO"))</pre>
43-
*
44-
* @param expectedString
45-
* the expected value of matched strings
46-
*/
47-
public static Matcher<String> equalToIgnoringCase(String expectedString) {
48-
return new IsEqualIgnoringCase(expectedString);
49-
}
50-
5136
}

hamcrest-library/src/main/java/org/hamcrest/text/IsEqualIgnoringWhiteSpace.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package org.hamcrest.text;
44

55
import org.hamcrest.Description;
6-
import org.hamcrest.Matcher;
76
import org.hamcrest.TypeSafeMatcher;
87

98
import static java.lang.Character.isWhitespace;
@@ -54,23 +53,4 @@ public String stripSpace(String toBeStripped) {
5453
}
5554
return result.toString().trim();
5655
}
57-
58-
/**
59-
* Creates a matcher of {@link String} that matches when the examined string is equal to
60-
* the specified expectedString, when whitespace differences are (mostly) ignored. To be
61-
* exact, the following whitespace rules are applied:
62-
* <ul>
63-
* <li>all leading and trailing whitespace of both the expectedString and the examined string are ignored</li>
64-
* <li>any remaining whitespace, appearing within either string, is collapsed to a single space before comparison</li>
65-
* </ul>
66-
* For example:
67-
* <pre>assertThat(" my\tfoo bar ", equalToIgnoringWhiteSpace(" my foo bar"))</pre>
68-
*
69-
* @param expectedString
70-
* the expected value of matched strings
71-
*/
72-
public static Matcher<String> equalToIgnoringWhiteSpace(String expectedString) {
73-
return new IsEqualIgnoringWhiteSpace(expectedString);
74-
}
75-
7656
}

0 commit comments

Comments
 (0)