Class AbstractEqualContentAs<T>

Package class diagram package AbstractEqualContentAs
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
          extended by<T>
Type Parameters:
T - the type of the matcher's expected values.
All Implemented Interfaces:
org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing
Direct Known Subclasses:
ReadsEqualContentAs, StreamsEqualContentAs

public abstract class AbstractEqualContentAs<T>
extends org.hamcrest.TypeSafeDiagnosingMatcher<T>

A matcher to check that the contents of two stream contain the identical information.

Constructor Summary
AbstractEqualContentAs(String expectedContent)
          Convenience constructor if the content is served as a String.
Method Summary
 void describeTo(org.hamcrest.Description description)
 String getActualContent()
          Returns the actual content found.
protected  boolean matchesSafely(T actual, org.hamcrest.Description mismatchDescription)
protected abstract  String toString(T actual)
          Turns the instance to its string representation.
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public AbstractEqualContentAs(String expectedContent)
Convenience constructor if the content is served as a String.

expectedContent - the expected content.
Method Detail


public final String getActualContent()
Returns the actual content found. If null no value has yet been read.

Since the reader cannot be read twice, the content is stored after the first read.

the actual content found. May be null.


public final void describeTo(org.hamcrest.Description description)

See Also:


protected final boolean matchesSafely(T actual,
                                      org.hamcrest.Description mismatchDescription)

Specified by:
matchesSafely in class org.hamcrest.TypeSafeDiagnosingMatcher<T>
See Also:
TypeSafeDiagnosingMatcher.matchesSafely(java.lang.Object, org.hamcrest.Description)


protected abstract String toString(T actual)
                            throws IllegalArgumentException
Turns the instance to its string representation.

actual - the instance whose string representation is requested.
the string representation of actual.
IllegalArgumentException - if no string representation can be created.

Copyright © 2008-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.