@Test
  public final void testUdf() throws Exception {
    InspectableObject [] data = getBaseTable();
    List<ExprNodeDesc> expressionList = getExpressionList();
    SelectDesc selectCtx = new SelectDesc(expressionList,
        OperatorTestUtils.createOutputColumnNames(expressionList));
    Operator<SelectDesc> op = OperatorFactory.get(new CompilationOpContext(), SelectDesc.class);
    op.setConf(selectCtx);
    CollectDesc cd = new CollectDesc(Integer.valueOf(10));
    CollectOperator cdop = (CollectOperator) OperatorFactory.getAndMakeChild(cd, op);
    op.initialize(new JobConf(OperatorTestUtils.class), new ObjectInspector[] {data[0].oi});
    OperatorTestUtils.assertResults(op, cdop, data, getExpectedResult());
  }
This method drives the test. It takes the data from getBaseTable() and
feeds it through a SELECT operator with a COLLECT operator after. Each
row that is produced by the collect operator is compared to getExpectedResult()
and if every row is the expected result the method completes without asserting.
@throws HiveException
ql/src/test/org/apache/hadoop/hive/ql/testutil/BaseScalarUdfTest.java