Class IsEqualIgnoringCase

All Implemented Interfaces:
Matcher<String>, SelfDescribing

public class IsEqualIgnoringCase extends TypeSafeMatcher<String>
Tests if a string is equal to another string, regardless of the case.
  • Constructor Details

    • IsEqualIgnoringCase

      public IsEqualIgnoringCase(String string)
      Constructor, best called from equalToIgnoringCase(String).
      Parameters:
      string - the expected string
  • Method Details

    • matchesSafely

      public boolean matchesSafely(String item)
      Description copied from class: TypeSafeMatcher
      Check if the item matches. The item will already have been checked for the specific type and will never be null. Subclasses should implement this.
      Specified by:
      matchesSafely in class TypeSafeMatcher<String>
      Parameters:
      item - the type safe item to match against.
      Returns:
      boolean true/false depending if item matches matcher.
    • describeMismatchSafely

      public void describeMismatchSafely(String item, Description mismatchDescription)
      Description copied from class: TypeSafeMatcher
      Describe the mismatch. The item will already have been checked for the specific type and will never be null. Subclasses should override this.
      Overrides:
      describeMismatchSafely in class TypeSafeMatcher<String>
      Parameters:
      item - the type safe item to match against.
      mismatchDescription - the mismatch description.
    • describeTo

      public void describeTo(Description description)
      Description copied from interface: SelfDescribing
      Generates a description of the object. The description may be part of a description of a larger object of which this is just a component, so it should be worded appropriately.
      Parameters:
      description - The description to be built or appended to.
    • equalToIgnoringCase

      public static Matcher<String> equalToIgnoringCase(String expectedString)
      Creates a matcher of String that matches when the examined string is equal to the specified expectedString, ignoring case. For example:
      assertThat("Foo", equalToIgnoringCase("FOO"))
      Parameters:
      expectedString - the expected value of matched strings
      Returns:
      The matcher.