01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.xs.bindings;
17:
18: import javax.xml.bind.ValidationException;
19: import javax.xml.namespace.QName;
20:
21: import org.geotools.xs.TestSchema;
22:
23: public class XSBooleanStrategyTest extends TestSchema {
24: /**
25: * An instance of a datatype that is defined as ??boolean?? can have the
26: * following legal literals {true, false, 1, 0}.
27: * @throws Exception
28: *
29: */
30:
31: /*
32: * Test method for 'org.geotools.xs.strategies.XSBooleanStrategy.parse(Element, Node[], Object)'
33: */
34: public void testTruth() throws Exception {
35: validateValues("true", Boolean.TRUE);
36: validateValues("false", Boolean.FALSE);
37: validateValues("1", Boolean.TRUE);
38: validateValues("0", Boolean.FALSE);
39: }
40:
41: public void testUntruth() throws Exception {
42: try {
43: validateValues("TRUE", Boolean.FALSE);
44: fail("TRUTH is not absolute");
45: } catch (ValidationException expected) {
46: // yeah!
47: }
48: }
49:
50: protected QName getQName() {
51: return XS.BOOLEAN;
52: }
53: }
|