01: /*
02: * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: package test.org.mandarax.reference;
19:
20: import org.mandarax.kernel.InferenceEngine;
21: import org.mandarax.kernel.InferenceException;
22: import org.mandarax.kernel.KnowledgeBase;
23: import org.mandarax.kernel.ResultSet;
24:
25: /**
26: * Test case for testing what happens when we attempt to fetch results and there
27: * are no more results available.
28: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
29: * @version 3.4 <7 March 05>
30: * @since 1.7
31: */
32: public class TestResultSet7 extends TestResultSet {
33:
34: /**
35: * Constructor.
36: * @param kb a new, uninitialized knowledge base that will be used
37: * @param ie the inference engine that will be tested
38: */
39: public TestResultSet7(KnowledgeBase kb, InferenceEngine ie) {
40: super (kb, ie);
41: }
42:
43: /**
44: * Get a description of this test case.
45: * This is used by the <code>org.mandarax.demo</code>
46: * package to display the test cases.
47: * @return a brief description of the test case
48: */
49: public String getDescription() {
50: return "Test ResultSet";
51: }
52:
53: /**
54: * Test the result set. Note that the result set is uninitialized (nothing has been fetched).
55: * @param rs the result set
56: * @return false if the test fails and true otherwise
57: */
58: public boolean testResultSet(ResultSet rs) {
59: try {
60: rs.next();
61: rs.next();
62: rs.getResult(Person.class, "x");
63:
64: } catch (InferenceException x) {
65: return true;
66: }
67: return false;
68: }
69: }
|