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.ser;
19:
20: import java.lang.reflect.Method;
21:
22: import org.mandarax.kernel.Function;
23: import org.mandarax.kernel.LogicFactory;
24: import org.mandarax.kernel.Term;
25: import org.mandarax.kernel.meta.JFunction;
26:
27: /**
28: * Test serialization of complex terms.
29: * @see org.mandarax.kernel.ComplexTerm
30: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
31: * @version 3.4 <7 March 05>
32: * @since 1.9.1
33: */
34: public class SerializationTestCase4ComplexTerms extends
35: SerializationTestCase {
36:
37: /**
38: * Constructor.
39: * @param lfactory the logic factory used
40: */
41: public SerializationTestCase4ComplexTerms(LogicFactory lfactory) {
42: super (lfactory);
43: }
44:
45: /**
46: * Constructor.
47: */
48: public SerializationTestCase4ComplexTerms() {
49: super ();
50: }
51:
52: /**
53: * Get the object to be tested.
54: * @return an object
55: */
56: protected Object getObject() {
57: try {
58: Method m = SerializableTestObject.class.getMethod("getId",
59: new Class[0]);
60: Function f = new JFunction(m, "a function");
61: Term[] terms = { lfactory.createVariableTerm("x",
62: SerializableTestObject.class) };
63: return lfactory.createComplexTerm(f, terms);
64: } catch (Exception x) {
65: x.printStackTrace();
66: }
67: return null;
68: }
69:
70: }
|