Class MultilineTextMatcher

  • All Implemented Interfaces:
    org.hamcrest.Matcher<String>, org.hamcrest.SelfDescribing

    public class MultilineTextMatcher
    extends org.hamcrest.TypeSafeMatcher<String>
    This class implements a matcher for multi-line text that helps finding the differences more quickly.
    • Constructor Detail

      • MultilineTextMatcher

        public MultilineTextMatcher​(String originalText)
        Create a new instance.
        Parameters:
        originalText - the original text
    • Method Detail

      • matchesSafely

        public boolean matchesSafely​(String text)
        Match the text against the original text. A full match (including line separators) is required.
        Specified by:
        matchesSafely in class org.hamcrest.TypeSafeMatcher<String>
        Parameters:
        text - the text to be matched against the original text.
      • describeMismatchSafely

        protected void describeMismatchSafely​(String text,
                                              org.hamcrest.Description mismatchDescription)
        Overrides:
        describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<String>
      • describeTo

        public void describeTo​(org.hamcrest.Description description)
      • matchesAllLines

        public static MultilineTextMatcher matchesAllLines​(String... lines)
        Factory method for multi-line text matcher
        Parameters:
        lines - the expected lines
        Returns:
        the matcher