Skip to content

Commit

Permalink
Add AndTestCases #392
Browse files Browse the repository at this point in the history
  • Loading branch information
mehyil committed Aug 8, 2017
1 parent 49b4015 commit 8fb3218
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/test/java/org/cactoos/scalar/AndTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.cactoos.Proc;
import org.cactoos.Scalar;
import org.cactoos.ScalarHasValue;
import org.cactoos.func.FuncOf;
Expand All @@ -38,8 +39,8 @@

/**
* Test case for {@link And}.
*
* @author Vseslav Sekorin ([email protected])
* @author Mehmet Yildirim ([email protected])
* @version $Id$
* @since 0.8
* @checkstyle JavadocMethodCheck (500 lines)
Expand Down Expand Up @@ -139,4 +140,28 @@ public void iteratesEmptyList() {
);
}

@Test
public void testProc() throws Exception {
final List<Integer> list = new LinkedList<>();
new And(
(Proc<Integer>) list::add,
1, 1
).value();
MatcherAssert.assertThat(
list.size(),
Matchers.equalTo(2)
);
}

@Test
public void testFunc() throws Exception {
MatcherAssert.assertThat(
new And(
input -> input > 0,
1, -1, 0
).value(),
Matchers.equalTo(false)
);
}

}

0 comments on commit 8fb3218

Please sign in to comment.