/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, ignoring case. * <p/> * For example: * <pre>assertThat("Foo", equalToIgnoringCase("FOO"))</pre> * * @param expectedString * the expected value of matched strings */ public static org.hamcrest.Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString) { return org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase(expectedString); }
/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, ignoring case. * For example: * <pre>assertThat("Foo", equalToIgnoringCase("FOO"))</pre> * * @param expectedString * the expected value of matched strings */ public static Matcher<String> equalToIgnoringCase(String expectedString) { return new IsEqualIgnoringCase(expectedString); }
/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, ignoring case. * For example: * <pre>assertThat("Foo", equalToIgnoringCase("FOO"))</pre> * * @param expectedString * the expected value of matched strings */ public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString) { return org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase(expectedString); }
/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, ignoring case. * <p/> * For example: * <pre>assertThat("Foo", equalToIgnoringCase("FOO"))</pre> * * @param expectedString * the expected value of matched strings */ @Factory public static Matcher<String> equalToIgnoringCase(String expectedString) { return new IsEqualIgnoringCase(expectedString); }
@Test(expected=IllegalArgumentException.class) public void canOnlyBeConstructedAboutANonNullString() { equalToIgnoringCase(null); }
/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, ignoring case. * For example: * <pre>assertThat("Foo", equalToIgnoringCase("FOO"))</pre> * * @param expectedString * the expected value of matched strings */ public static Matcher<String> equalToIgnoringCase(String expectedString) { return new IsEqualIgnoringCase(expectedString); }
@Test public void describesItself() { final Matcher<String> matcher = equalToIgnoringCase("heLLo"); assertDescription("a string equal to \"heLLo\" ignoring case", matcher); }
/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, ignoring case. * For example: * <pre>assertThat("Foo", equalToIgnoringCase("FOO"))</pre> * * @param expectedString * the expected value of matched strings */ public static Matcher<String> equalToIgnoringCase(String expectedString) { return new IsEqualIgnoringCase(expectedString); }
@Test public void describesAMismatch() { final Matcher<String> matcher = equalToIgnoringCase("heLLo"); String expectedMismatchString = "was \"Cheese\""; assertMismatchDescription(expectedMismatchString, matcher, "Cheese"); } }
@Factory public static Matcher<String> equalToIgnoringCase(String string) { return new IsEqualIgnoringCase(string); }
@Test public void mismatchesNull() { final Matcher<String> matcher = equalToIgnoringCase("heLLo"); assertDoesNotMatch(matcher, null); }
@Test public void mismatchesIfAdditionalWhitespaceIsPresent() { final Matcher<String> matcher = equalToIgnoringCase("heLLo"); assertDoesNotMatch(matcher, "hello "); assertDoesNotMatch(matcher, " hello"); }
@Test public void copesWithNullsAndUnknownTypes() { Matcher<String> matcher = equalToIgnoringCase("irrelevant"); assertNullSafe(matcher); assertUnknownTypeSafe(matcher); }
/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, ignoring case. * For example: * <pre>assertThat("Foo", equalToIgnoringCase("FOO"))</pre> * * @param expectedString * the expected value of matched strings */ public static org.hamcrest.Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString) { return org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase(expectedString); }
@Test public void ignoresCaseOfCharsInString() { final Matcher<String> matcher = equalToIgnoringCase("heLLo"); assertMatches(matcher, "HELLO"); assertMatches(matcher, "hello"); assertMatches(matcher, "HelLo"); assertDoesNotMatch(matcher, "bye"); }
/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, ignoring case. * For example: * <pre>assertThat("Foo", equalToIgnoringCase("FOO"))</pre> * * @param expectedString * the expected value of matched strings */ public static Matcher<java.lang.String> equalToIgnoringCase(java.lang.String expectedString) { return org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase(expectedString); }
public static org.hamcrest.Matcher<java.lang.String> equalToIgnoringCase(java.lang.String string) { return org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase(string); }
@Override public boolean apply(@Nullable Field field) { if (field == null) return false; return equalToIgnoringCase(name).matches(field.getName()); } };
@Override public boolean apply(@Nullable Field field) { if (field == null) return false; return equalToIgnoringCase(name).matches(field.getName()); } };
/** * Contains field with a string value ignoring case. * * @param fieldName Field name to match * @param fieldValue Field value to match * @return Matcher */ public static IsContainingStringFieldValue containsStringFieldValueIgnoringCase(final String fieldName, final String fieldValue) { return containsStringFieldValue(fieldName, IsEqualIgnoringCase.equalToIgnoringCase(fieldValue)); }