Skip to content

Commit

Permalink
(#75) Code reformat. IsEqual changed into TextIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
borysfan committed Jan 27, 2019
1 parent 0cefc50 commit 24489ea
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ public InputHasContent(final String text) {
* @param text The text to match against
*/
public InputHasContent(final Text text) {
this(new MatcherOf<>(
(String input) -> text.asString().equals(input), text
));
this(
new MatcherOf<>(
(String input) -> text.asString().equals(input), text
)
);
}

/**
Expand All @@ -65,7 +67,7 @@ public InputHasContent(final Text text) {
*/
public InputHasContent(final Matcher<String> mtr) {
super(
// @checkstyle IndentationCheck (6 line)
// @checkstyle IndentationCheck (9 line)
input -> mtr.matches(
new TextOf(input).asString()
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public MatcherEnvelope(
) {
this(
new TypeSafeMatcher<T>() {

@Override
public void describeTo(final Description desc) {
new UncheckedProc<>(description).exec(desc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
package org.llorllale.cactoos.matchers;

import org.cactoos.io.InputOf;
import org.cactoos.text.JoinedText;
import org.cactoos.text.UncheckedText;
import org.hamcrest.Description;
import org.hamcrest.StringDescription;
import org.hamcrest.core.IsEqual;
import org.junit.Test;

/**
Expand Down Expand Up @@ -61,23 +62,28 @@ public void failsIfContentDoesNotMatch() {
new InputHasContent("world").describeMismatchSafely(
new InputOf("hello"), description
);
return description.toString();
return new UncheckedText(description.toString());
},
new IsEqual<>("has content \"hello\"")
new TextIs("has content \"hello\"")
).affirm();
}

@Test
public void describesExpectedValues() {
new Assertion<>(
"The matcher print the value which should be present in the "
+ "target iterable",
new UncheckedText(
new JoinedText(
" ",
"The matcher print the value which should be present",
"in the target iterable"
)
).asString(),
() -> {
final Description description = new StringDescription();
new InputHasContent("world").describeTo(description);
return description.toString();
return new UncheckedText(description.toString());
},
new IsEqual<>("has content \"world\"")
new TextIs("has content \"world\"")
).affirm();
}

Expand Down

0 comments on commit 24489ea

Please sign in to comment.