@Test
public void testBadInput() throws Exception {

    Over func = new Over();
    boolean caught = false;
    Tuple t = TupleFactory.getInstance().newTuple();
    t.append("Mary had a little lamb");
    t.append("count");
    t.append(0);
    t.append(0);
    try {
        func.exec(t);
    } catch (ExecException ee) {
        caught = true;
        assertEquals("Over expected a bag for arg 1 but received chararray",
                ee.getMessage());
    }
    assertTrue(caught);
    func = new Over();
    DataBag inbag = BagFactory.getInstance().newDefaultBag();
    for (int i = 0; i < 10; i++) {
        t = TupleFactory.getInstance().newTuple(1);
        t.set(0, 1);
        inbag.add(t);
    }
    t = TupleFactory.getInstance().newTuple();
    t.append(inbag);
    caught = false;
    try {
        func.exec(t);
    } catch (ExecException ee) {
        caught = true;
        assertEquals("Over expected 2 or more inputs but received 1",
                ee.getMessage());
    }
    assertTrue(caught);
    func = new Over();
    t.append(1);
    caught = false;
    try {
        func.exec(t);
    } catch (ExecException ee) {
        caught = true;
        assertEquals("Over expected a string for arg 2 but received int",
                ee.getMessage());
    }
    assertTrue(caught);
    func = new Over();
    t.set(1, "count");
    t.append("fred");
    caught = false;
    try {
        func.exec(t);
    } catch (ExecException ee) {
        caught = true;
        assertEquals("Over expected an integer for arg 3 but received chararray",
                ee.getMessage());
    }
    assertTrue(caught);
    func = new Over();
    t.set(2, -1);
    t.append("fred");
    caught = false;
    try {
        func.exec(t);
    } catch (ExecException ee) {
        caught = true;
        assertEquals("Over expected an integer for arg 4 but received chararray",
                ee.getMessage());
    }
    assertTrue(caught);
}