Class AbstractHmTextBody<T>

  • Type Parameters:
    T - Item type. Should be able to return own body
    All Implemented Interfaces:
    org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing
    Direct Known Subclasses:
    HmRqTextBody, HmRsTextBody

    public abstract class AbstractHmTextBody<T>
    extends org.hamcrest.TypeSafeMatcher<T>
    Text body matcher.

    This "matcher" tests given item body, assuming that it has text content.

    The class is immutable and thread-safe.

    Since:
    2.0
    • Constructor Detail

      • AbstractHmTextBody

        public AbstractHmTextBody​(org.hamcrest.Matcher<String> body,
                                  Charset charset)
        Ctor.
        Parameters:
        body - Body matcher.
        charset - Charset of the text.
    • Method Detail

      • describeTo

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

        protected final boolean matchesSafely​(T item)
        Specified by:
        matchesSafely in class org.hamcrest.TypeSafeMatcher<T>
      • describeMismatchSafely

        protected final void describeMismatchSafely​(T item,
                                                    org.hamcrest.Description description)
        Overrides:
        describeMismatchSafely in class org.hamcrest.TypeSafeMatcher<T>
      • itemBody

        protected abstract InputStream itemBody​(T item)
                                         throws IOException
        Item's body.
        Parameters:
        item - Item to retrieve body from
        Returns:
        InputStream of body
        Throws:
        IOException - If some problem inside