test for iterable
@@ -24,6 +24,8 @@ import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
import java.util.List;
/**
@@ -56,4 +58,28 @@ public class OContainsConditionTest {
right.add(null);
Assert.assertTrue(op.execute(left, right));
}
+
+ @Test
+ public void testIterable() {
+ Iterable left = new Iterable() {
+ private final List<Integer> ls = Arrays.asList(3, 1, 2);
+
+ @Override
+ public Iterator iterator() {
+ return ls.iterator();
+ }
+ };
+
+ Iterable right = new Iterable() {
+ private final List<Integer> ls = Arrays.asList(2, 3);
+
+ @Override
+ public Iterator iterator() {
+ return ls.iterator();
+ }
+ };
+
+ OContainsCondition op = new OContainsCondition(-1);
+ Assert.assertTrue(op.execute(left, right));
+ }
}
