de.smartics.util.test.matcher.io
Class AbstractEqualContentAs<T>

Package class diagram package AbstractEqualContentAs
java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
          extended by de.smartics.util.test.matcher.io.AbstractEqualContentAs<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

AbstractEqualContentAs

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

Parameters:
expectedContent - the expected content.
Method Detail

getActualContent

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.

Returns:
the actual content found. May be null.

describeTo

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

See Also:
SelfDescribing.describeTo(org.hamcrest.Description)

matchesSafely

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)

toString

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

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


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