geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject [44/51] [abbrv] incubator-geode git commit: GEODE-785: Moved CompiledInJUnitTest.java to the test directory
Date Fri, 22 Jan 2016 23:26:25 GMT
GEODE-785: Moved CompiledInJUnitTest.java to the test directory


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/1fb91ec9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/1fb91ec9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/1fb91ec9

Branch: refs/heads/wan_cq_donation
Commit: 1fb91ec9ec430cb6b825c4401794538bad8fc983
Parents: fc8726f
Author: Jason Huynh <huynhja@gmail.com>
Authored: Fri Jan 22 11:07:13 2016 -0800
Committer: Jason Huynh <huynhja@gmail.com>
Committed: Fri Jan 22 11:08:45 2016 -0800

----------------------------------------------------------------------
 .../query/internal/CompiledInJUnitTest.java     | 405 -------------------
 .../query/internal/CompiledInJUnitTest.java     | 405 +++++++++++++++++++
 2 files changed, 405 insertions(+), 405 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1fb91ec9/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CompiledInJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CompiledInJUnitTest.java
b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CompiledInJUnitTest.java
deleted file mode 100644
index 755edcf..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/CompiledInJUnitTest.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.cache.query.internal;
-
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.isA;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.cache.query.TypeMismatchException;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class CompiledInJUnitTest {
-
-  ExecutionContext context;
-  CompiledValue elm;
-  CompiledValue colln;
-
-  @Before
-  public void setup() {
-    context = mock(ExecutionContext.class);
-    elm = mock(CompiledValue.class);
-    colln = mock(CompiledValue.class);
-  }
-
-  @Test
-  public void testShouldNotThrowTypeMismatchWithNullElementAndObjectArray() throws Exception
{
-    Object[] objectValues = new Object[] { true, true };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(null);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(objectValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-  }
-
-  @Test
-  public void testTypeMismatchWithNullElementAndPrimitiveArray() throws Exception {
-    boolean[] booleanValues = new boolean[] { true, true };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(null);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(booleanValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    try {
-      Object result = compiledIn.evaluate(context);
-      fail("TypeMismatchException should be thrown");
-    } catch (TypeMismatchException e) {
-
-    }
-  }
-
-  @Test
-  public void testEvaluatesFalseForStringAgainstShortArray() throws Exception {
-    short[] shortValues = new short[] { 1, 1 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("1");
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(shortValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueForFloatAgainstShortArray() throws Exception {
-    short[] shortValues = new short[] { 1, 1 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(new Float(1.0));
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(shortValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueForShortAgainstShortArray() throws Exception {
-    short[] shortValues = new short[] { 1, 2 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(shortValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueForIntegerAgainstShortArray() throws Exception {
-    short[] shortValues = new short[] { 1, 2 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(new Integer(1));
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(shortValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesFalseForStringAgainstBooleanArray() throws Exception {
-    boolean[] booleanValues = new boolean[] { true, true };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("true");
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(booleanValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesFalseWithBooleanArrayNotMatchingBooleanElement() throws Exception
{
-    boolean[] booleanValues = new boolean[] { true, true };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(false);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(booleanValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWithBooleanArrayMatchingBooleanElement() throws Exception
{
-    boolean[] booleanValues = new boolean[] { true, true };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(true);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(booleanValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWithBooleanArrayMatchingBooleanFalseElement() throws Exception
{
-    boolean[] booleanValues = new boolean[] { false, false };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(false);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(booleanValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWithCharArrayMatchingCharElement() throws Exception {
-    char[] charValues = new char[] { 'a', 'b', '1' };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn('a');
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(charValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWitCharArrayNotMatchingCharElement() throws Exception {
-    char[] charValues = new char[] { 'a', 'b', '1' };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn('c');
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(charValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testStringDoesNotMatchCharElements() throws Exception {
-    char[] charValues = new char[] { 'a', 'b', '1' };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("a");
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(charValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testIntegerDoesNotMatchCharElements() throws Exception {
-    char[] charValues = new char[] { 'a', 'b', '1' };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(97);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(charValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesFalseWithByteArrayNotMatchingIntegerElement() throws Exception
{
-    byte[] byteValues = new byte[] { 127, 2, 3 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(127);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(byteValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesFalseWithByteArrayNotMatchingLargerIntegerElement() throws Exception
{
-    byte[] byteValues = new byte[] { 127, 2, 3 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(128);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(byteValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWithByteArrayMatchingByteElement() throws Exception {
-    byte[] byteValues = new byte[] { 1, 2, 3 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn((Byte.valueOf("1")));
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(byteValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluateNotMatchingLongElement() throws Exception {
-    long[] longValues = new long[] { 1, 2, 3 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(4L);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(longValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWithLongArrayMatchingLongElement() throws Exception {
-    long[] longValues = new long[] { 1, 2, 3 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1L);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(longValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWithSecondElementOfLongArrayMatchingLongElement() throws Exception
{
-    long[] longValues = new long[] { 1, 2, 3 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(2L);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(longValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWithLongArrayMatchingAndDoubleElement() throws Exception {
-    long[] longValues = new long[] { 1, 2, 3 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1D);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(longValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWithLongArrayMatchingAndIntegerElement() throws Exception
{
-    long[] longValues = new long[] { 1, 2, 3 };
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(new Integer(1));
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(longValues);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testExceptionThrownWhenEvaluateAgainstANonCollection() throws Exception {
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn("NotACollection");
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    try {
-      Object result = compiledIn.evaluate(context);
-      fail("should throw a TypeMismatchException");
-    } catch (TypeMismatchException e) {
-      // expected
-    }
-  }
-
-  @Test
-  public void testEvaluatesFalseWhenIntegerNotInCollection() throws Exception {
-    Collection collection = new ArrayList();
-    collection.add(1);
-    collection.add(2);
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(3);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWhenIntegerInIntegerCollection() throws Exception {
-    Collection collection = new ArrayList();
-    collection.add(1);
-    collection.add(2);
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWhenIntegerInSingleElementIntegerCollection() throws Exception
{
-    Collection collection = new ArrayList();
-    collection.add(1);
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  // String form
-  @Test
-  public void testEvaluatesFalseWhenIntegerNotInStringCollection() throws Exception {
-    Collection collection = new ArrayList();
-    collection.add("1");
-    collection.add("2");
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1);
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesFalseWhenStringNotInStringCollection() throws Exception {
-    Collection collection = new ArrayList();
-    collection.add("1");
-    collection.add("2");
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("3");
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertFalse((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWhenStringInStringCollection() throws Exception {
-    Collection collection = new ArrayList();
-    collection.add("1");
-    collection.add("2");
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("1");
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testEvaluatesTrueWhenStringInSingleElementStringCollection() throws Exception
{
-    Collection collection = new ArrayList();
-    collection.add("1");
-    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("1");
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertTrue((Boolean) result);
-  }
-
-  @Test
-  public void testCompiledInCanEvaluate() throws Exception {
-    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(new ArrayList());
-
-    CompiledIn compiledIn = new CompiledIn(elm, colln);
-    Object result = compiledIn.evaluate(context);
-    Assert.assertNotNull(result);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1fb91ec9/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/internal/CompiledInJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/internal/CompiledInJUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/internal/CompiledInJUnitTest.java
new file mode 100644
index 0000000..755edcf
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/internal/CompiledInJUnitTest.java
@@ -0,0 +1,405 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.cache.query.internal;
+
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.query.TypeMismatchException;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class CompiledInJUnitTest {
+
+  ExecutionContext context;
+  CompiledValue elm;
+  CompiledValue colln;
+
+  @Before
+  public void setup() {
+    context = mock(ExecutionContext.class);
+    elm = mock(CompiledValue.class);
+    colln = mock(CompiledValue.class);
+  }
+
+  @Test
+  public void testShouldNotThrowTypeMismatchWithNullElementAndObjectArray() throws Exception
{
+    Object[] objectValues = new Object[] { true, true };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(null);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(objectValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+  }
+
+  @Test
+  public void testTypeMismatchWithNullElementAndPrimitiveArray() throws Exception {
+    boolean[] booleanValues = new boolean[] { true, true };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(null);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(booleanValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    try {
+      Object result = compiledIn.evaluate(context);
+      fail("TypeMismatchException should be thrown");
+    } catch (TypeMismatchException e) {
+
+    }
+  }
+
+  @Test
+  public void testEvaluatesFalseForStringAgainstShortArray() throws Exception {
+    short[] shortValues = new short[] { 1, 1 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("1");
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(shortValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueForFloatAgainstShortArray() throws Exception {
+    short[] shortValues = new short[] { 1, 1 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(new Float(1.0));
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(shortValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueForShortAgainstShortArray() throws Exception {
+    short[] shortValues = new short[] { 1, 2 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(shortValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueForIntegerAgainstShortArray() throws Exception {
+    short[] shortValues = new short[] { 1, 2 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(new Integer(1));
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(shortValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesFalseForStringAgainstBooleanArray() throws Exception {
+    boolean[] booleanValues = new boolean[] { true, true };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("true");
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(booleanValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesFalseWithBooleanArrayNotMatchingBooleanElement() throws Exception
{
+    boolean[] booleanValues = new boolean[] { true, true };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(false);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(booleanValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWithBooleanArrayMatchingBooleanElement() throws Exception
{
+    boolean[] booleanValues = new boolean[] { true, true };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(true);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(booleanValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWithBooleanArrayMatchingBooleanFalseElement() throws Exception
{
+    boolean[] booleanValues = new boolean[] { false, false };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(false);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(booleanValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWithCharArrayMatchingCharElement() throws Exception {
+    char[] charValues = new char[] { 'a', 'b', '1' };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn('a');
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(charValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWitCharArrayNotMatchingCharElement() throws Exception {
+    char[] charValues = new char[] { 'a', 'b', '1' };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn('c');
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(charValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testStringDoesNotMatchCharElements() throws Exception {
+    char[] charValues = new char[] { 'a', 'b', '1' };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("a");
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(charValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testIntegerDoesNotMatchCharElements() throws Exception {
+    char[] charValues = new char[] { 'a', 'b', '1' };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(97);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(charValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesFalseWithByteArrayNotMatchingIntegerElement() throws Exception
{
+    byte[] byteValues = new byte[] { 127, 2, 3 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(127);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(byteValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesFalseWithByteArrayNotMatchingLargerIntegerElement() throws Exception
{
+    byte[] byteValues = new byte[] { 127, 2, 3 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(128);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(byteValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWithByteArrayMatchingByteElement() throws Exception {
+    byte[] byteValues = new byte[] { 1, 2, 3 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn((Byte.valueOf("1")));
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(byteValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluateNotMatchingLongElement() throws Exception {
+    long[] longValues = new long[] { 1, 2, 3 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(4L);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(longValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWithLongArrayMatchingLongElement() throws Exception {
+    long[] longValues = new long[] { 1, 2, 3 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1L);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(longValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWithSecondElementOfLongArrayMatchingLongElement() throws Exception
{
+    long[] longValues = new long[] { 1, 2, 3 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(2L);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(longValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWithLongArrayMatchingAndDoubleElement() throws Exception {
+    long[] longValues = new long[] { 1, 2, 3 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1D);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(longValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWithLongArrayMatchingAndIntegerElement() throws Exception
{
+    long[] longValues = new long[] { 1, 2, 3 };
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(new Integer(1));
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(longValues);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testExceptionThrownWhenEvaluateAgainstANonCollection() throws Exception {
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn("NotACollection");
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    try {
+      Object result = compiledIn.evaluate(context);
+      fail("should throw a TypeMismatchException");
+    } catch (TypeMismatchException e) {
+      // expected
+    }
+  }
+
+  @Test
+  public void testEvaluatesFalseWhenIntegerNotInCollection() throws Exception {
+    Collection collection = new ArrayList();
+    collection.add(1);
+    collection.add(2);
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(3);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWhenIntegerInIntegerCollection() throws Exception {
+    Collection collection = new ArrayList();
+    collection.add(1);
+    collection.add(2);
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWhenIntegerInSingleElementIntegerCollection() throws Exception
{
+    Collection collection = new ArrayList();
+    collection.add(1);
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  // String form
+  @Test
+  public void testEvaluatesFalseWhenIntegerNotInStringCollection() throws Exception {
+    Collection collection = new ArrayList();
+    collection.add("1");
+    collection.add("2");
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn(1);
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesFalseWhenStringNotInStringCollection() throws Exception {
+    Collection collection = new ArrayList();
+    collection.add("1");
+    collection.add("2");
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("3");
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertFalse((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWhenStringInStringCollection() throws Exception {
+    Collection collection = new ArrayList();
+    collection.add("1");
+    collection.add("2");
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("1");
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testEvaluatesTrueWhenStringInSingleElementStringCollection() throws Exception
{
+    Collection collection = new ArrayList();
+    collection.add("1");
+    when(elm.evaluate(isA(ExecutionContext.class))).thenReturn("1");
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(collection);
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertTrue((Boolean) result);
+  }
+
+  @Test
+  public void testCompiledInCanEvaluate() throws Exception {
+    when(colln.evaluate(isA(ExecutionContext.class))).thenReturn(new ArrayList());
+
+    CompiledIn compiledIn = new CompiledIn(elm, colln);
+    Object result = compiledIn.evaluate(context);
+    Assert.assertNotNull(result);
+  }
+}


Mime
View raw message