|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hamcrest.BaseMatcher<T> org.hamcrest.TypeSafeDiagnosingMatcher<T> de.smartics.util.test.matcher.io.AbstractEqualContentAs<Reader> de.smartics.util.test.matcher.io.ReadsEqualContentAs
public class ReadsEqualContentAs
A matcher to check that the contents of two stream contain the identical information.
Add Import
import static de.smartics.util.test.matcher.io.ReadsEqualContentAs.readsEqualContentAs;
In the following examples expected
and actual
are Reader
s:
Assert Example
import static org.hamcrest.MatcherAssert.assertThat; assertThat(actual, readsEqualContentAs(expected));
The following example shows a test spy and the verification of the expected stream argument:
Verify Example
import static org.mockito.Matchers.argThat; import static org.mockito.Mockito.verify; spy.pass(actual); // Test spy that expects a reader verify(spy).pass( (Reader) argThat(readsEqualContentAs(expected)));
Constructor Summary | |
---|---|
ReadsEqualContentAs(Reader expected) Default constructor. |
|
ReadsEqualContentAs(String expectedContent) Convenience constructor if the content is served as a String. |
Method Summary | |
---|---|
static org.hamcrest.Matcher<? super Reader> |
readsEqualContentAs(InputStream expected, String encoding) Factory method to create the matcher. |
static org.hamcrest.Matcher<? super Reader> |
readsEqualContentAs(Reader expected) Factory method to create the matcher. |
static org.hamcrest.Matcher<? super Reader> |
readsEqualContentAs(String expected) Factory method to create the matcher. |
protected String |
toString(Reader actual) Turns the instance to its string representation. |
Methods inherited from class de.smartics.util.test.matcher.io.AbstractEqualContentAs |
---|
describeTo, getActualContent, matchesSafely |
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 ReadsEqualContentAs(Reader expected) throws IllegalArgumentException
expected
- the other stream to compare to.
IllegalArgumentException
- on any problem reading from the stream.
public ReadsEqualContentAs(String expectedContent)
expectedContent
- the expected content.
Method Detail |
---|
protected final String toString(Reader actual) throws IllegalArgumentException
toString
in class
AbstractEqualContentAs<Reader>
actual
- the instance whose string representation is requested.
actual
.
IllegalArgumentException
- if no string representation can be created.
AbstractEqualContentAs.toString(java.lang.Object)
public static org.hamcrest.Matcher<? super Reader> readsEqualContentAs(Reader expected) throws IllegalArgumentException
expected
- the expected stream content.
IllegalArgumentException
- on any problem reading from the stream.
public static org.hamcrest.Matcher<? super Reader> readsEqualContentAs(InputStream expected, String encoding) throws IllegalArgumentException
expected
- the expected stream content.
encoding
- the encoding used on the stream.
IllegalArgumentException
- on any problem reading from the stream.
public static org.hamcrest.Matcher<? super Reader> readsEqualContentAs(String expected)
expected
- the expected stream content.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |