[Javamatch-cvs] javamatch/src/net/sourceforge/javamatch/engine/test MatchEngineTest.java,1.2,1.3
Status: Pre-Alpha
Brought to you by:
iterson
From: Walter v. I. <it...@us...> - 2004-09-10 14:22:51
|
Update of /cvsroot/javamatch/javamatch/src/net/sourceforge/javamatch/engine/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18704/src/net/sourceforge/javamatch/engine/test Modified Files: MatchEngineTest.java Log Message: Added iterators, to support JDO extents Index: MatchEngineTest.java =================================================================== RCS file: /cvsroot/javamatch/javamatch/src/net/sourceforge/javamatch/engine/test/MatchEngineTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MatchEngineTest.java 7 Sep 2004 09:41:07 -0000 1.2 --- MatchEngineTest.java 10 Sep 2004 14:22:17 -0000 1.3 *************** *** 21,25 **** import junit.framework.*; import net.sourceforge.javamatch.engine.*; ! import net.sourceforge.javamatch.query.test.ConstantMatch; /** --- 21,25 ---- import junit.framework.*; import net.sourceforge.javamatch.engine.*; ! import net.sourceforge.javamatch.query.test.*; /** *************** *** 67,70 **** --- 67,131 ---- } + public void testExecuteNullQueryIterators() { + MatchEngine engine = new MatchEngine(); + Vector v = new Vector(); + try { + engine.executeQuery(null, v.iterator(), v.iterator()); + fail("Shouldn't be able to execute null query"); + } catch (NullPointerException npe) { + // should occur + } catch (MatchException me) { + fail("unable to match"); + } + } + + public void testExecuteNullDataIterator() { + MatchEngine engine = new MatchEngine(); + try { + engine.executeQuery(new ConstantMatch(3f), null, null); + fail("Shouldn't be able to execute query with null data"); + } catch (NullPointerException npe) { + // should occur + } catch (MatchException me) { + fail("unable to match"); + } + } + + public void testExecuteNullQueryDataIterator() { + MatchEngine engine = new MatchEngine(); + try { + engine.executeQuery(null, null, null); + fail("Shouldn't be able to execute null query with null data"); + } catch (NullPointerException npe) { + // should occur + } catch (MatchException me) { + fail("unable to match"); + } + } + + public void testExecuteOneIterator() { + MatchEngine engine = new MatchEngine(); + try { + MatchResult result = engine.executeQuery(new ConstantMatch(3f), new Vector().iterator(), null); + assertFalse(result.getResultIterator().hasNext()); + } catch (MatchException me) { + fail("unable to match"); + } + } + + public void testExecuteOneIteratorTwoPass() { + MatchEngine engine = new MatchEngine(); + MatchMock query = new MatchMock(); + query.setTwoPass(true); + try { + engine.executeQuery(query, new Vector().iterator(), null); + fail("shouldn't be able to execute two-pass query with one iterator"); + } catch (NullPointerException npe) { + // should occur + } catch (MatchException me) { + fail("unable to match"); + } + } + public void testAddNullListener() { MatchEngine engine = new MatchEngine(); |