use of org.cactoos.io.TeeInput in project cactoos by yegor256.
the class TeeInputHasResultTest method failsIfInputDoesNotMatchExpectedValue.
@Test
public void failsIfInputDoesNotMatchExpectedValue() {
final TeeInput matchable = new TeeInput(new TextOf("input"), new OutputTo(new ByteArrayOutputStream()));
final String expected = "expected-1";
final TeeInputHasResult matcher = new TeeInputHasResult(expected, new TextOf(expected));
MatcherAssert.assertThat("Matcher does not compare input and expected values", matcher.matchesSafely(matchable), new IsEqual<>(false));
}
use of org.cactoos.io.TeeInput in project cactoos by yegor256.
the class TeeInputHasResultTest method failsIfCopiedValueDoesNotMatchExpectedValue.
@Test
public void failsIfCopiedValueDoesNotMatchExpectedValue() {
final String expected = "expected-2";
final TeeInput matchable = new TeeInput(new TextOf(expected), new OutputTo(new ByteArrayOutputStream()));
final TeeInputHasResult matcher = new TeeInputHasResult(expected, new TextOf("incorrect"));
MatcherAssert.assertThat("Matcher does not compare copied and expected values", matcher.matchesSafely(matchable), new IsEqual<>(false));
}
use of org.cactoos.io.TeeInput in project cactoos by yegor256.
the class TeeInputHasResultTest method describesMismatchOfInputAndExpected.
@Test
public void describesMismatchOfInputAndExpected() {
final TeeInput matchable = new TeeInput(new TextOf("i"), new OutputTo(new ByteArrayOutputStream()));
final TeeInputHasResult matcher = new TeeInputHasResult("e", new TextOf("e"));
final StringDescription description = new StringDescription();
matcher.matchesSafely(matchable);
matcher.describeMismatchSafely(matchable, description);
MatcherAssert.assertThat("Description of mismatch of input and expected incorrect", description.toString(), new IsEqual<>("TeeInput with result \"e\" and copied value \"e\""));
}
use of org.cactoos.io.TeeInput in project cactoos by yegor256.
the class TeeInputHasResultTest method describesMismatchOfCopiedAndExpected.
@Test
public void describesMismatchOfCopiedAndExpected() {
final TeeInput matchable = new TeeInput(new TextOf("i"), new OutputTo(new ByteArrayOutputStream()));
final TeeInputHasResult matcher = new TeeInputHasResult("i", new TextOf("wrong"));
final StringDescription description = new StringDescription();
matcher.matchesSafely(matchable);
matcher.describeMismatchSafely(matchable, description);
MatcherAssert.assertThat("Description of mismatch of copied and expected incorrect", description.toString(), new IsEqual<>("TeeInput with result \"i\" and copied value \"i\""));
}
Aggregations