01: /*
02: (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: All rights reserved - see end of file.
04: $Id: NewRegressionAltMethods.java,v 1.5 2008/01/02 12:07:05 andy_seaborne Exp $
05: */
06:
07: package com.hp.hpl.jena.regression;
08:
09: import junit.framework.*;
10:
11: import com.hp.hpl.jena.rdf.model.*;
12: import com.hp.hpl.jena.vocabulary.RDF;
13: import com.hp.hpl.jena.regression.Regression.*;
14:
15: public class NewRegressionAltMethods extends
16: NewRegressionContainerMethods {
17: public NewRegressionAltMethods(String name) {
18: super (name);
19: }
20:
21: public static Test suite() {
22: return new TestSuite(NewRegressionAltMethods.class);
23: }
24:
25: protected Container createContainer() {
26: return m.createAlt();
27: }
28:
29: protected Resource getContainerType() {
30: return RDF.Alt;
31: }
32:
33: public void testDefaults() {
34: Alt a = m.createAlt();
35: Literal tvLiteral = m.createLiteral("test 12 string 2");
36: Resource tvResObj = m.createResource(new ResTestObjF());
37: Bag tvBag = m.createBag();
38: Alt tvAlt = m.createAlt();
39: Seq tvSeq = m.createSeq();
40: //
41: Resource tvResource = m.createResource();
42: assertEquals(tvLiteral, a.setDefault(tvLiteral).getDefault());
43: assertEquals(tvLiteral, a.getDefaultLiteral());
44: assertEquals(tvResource, a.setDefault(tvResource)
45: .getDefaultResource());
46: assertEquals(tvByte, a.setDefault(tvByte).getDefaultByte());
47: assertEquals(tvShort, a.setDefault(tvShort).getDefaultShort());
48: assertEquals(tvInt, a.setDefault(tvInt).getDefaultInt());
49: assertEquals(tvLong, a.setDefault(tvLong).getDefaultLong());
50: assertEquals(tvFloat, a.setDefault(tvFloat).getDefaultFloat(),
51: fDelta);
52: assertEquals(tvDouble, a.setDefault(tvDouble)
53: .getDefaultDouble(), dDelta);
54: assertEquals(tvChar, a.setDefault(tvChar).getDefaultChar());
55: assertEquals(tvString, a.setDefault(tvString)
56: .getDefaultString());
57: assertEquals(tvResObj, a.setDefault(tvResObj)
58: .getDefaultResource());
59: assertEquals(tvLitObj, a.setDefault(tvLitObj).getDefaultObject(
60: new LitTestObjF()));
61: assertEquals(tvAlt, a.setDefault(tvAlt).getDefaultAlt());
62: assertEquals(tvBag, a.setDefault(tvBag).getDefaultBag());
63: assertEquals(tvSeq, a.setDefault(tvSeq).getDefaultSeq());
64: }
65: }
66:
67: /*
68: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
69: * All rights reserved.
70: *
71: * Redistribution and use in source and binary forms, with or without
72: * modification, are permitted provided that the following conditions
73: * are met:
74: * 1. Redistributions of source code must retain the above copyright
75: * notice, this list of conditions and the following disclaimer.
76: * 2. Redistributions in binary form must reproduce the above copyright
77: * notice, this list of conditions and the following disclaimer in the
78: * documentation and/or other materials provided with the distribution.
79: * 3. The name of the author may not be used to endorse or promote products
80: * derived from this software without specific prior written permission.
81: *
82: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
83: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
84: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
85: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
86: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
87: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
88: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
89: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
90: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
91: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
92: */
|