01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2007, 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; either
09: * version 2.1 of the License, or (at your option) any later version.
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.referencing.wkt;
17:
18: // JUnit dependencies
19: import junit.framework.Test;
20: import junit.framework.TestCase;
21: import junit.framework.TestSuite;
22:
23: /**
24: * Tests the {@link Symbols} implementation.
25: *
26: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/test/java/org/geotools/referencing/wkt/SymbolsTest.java $
27: * @version $Id: SymbolsTest.java 25452 2007-05-07 15:07:13Z desruisseaux $
28: * @author Martin Desruisseaux
29: */
30: public class SymbolsTest extends TestCase {
31: /**
32: * Run the suite from the command line.
33: */
34: public static void main(String[] args) {
35: junit.textui.TestRunner.run(suite());
36: }
37:
38: /**
39: * Returns the test suite.
40: */
41: public static Test suite() {
42: return new TestSuite(SymbolsTest.class);
43: }
44:
45: /**
46: * Constructs a test case with the given name.
47: */
48: public SymbolsTest(final String name) {
49: super (name);
50: }
51:
52: /**
53: * Tests the {@link Symbols#containsAxis} method.
54: */
55: public void testContainsAxis() {
56: final Symbols s = Symbols.DEFAULT;
57: assertTrue("AXIS at the begining of a line.", s
58: .containsAxis("AXIS[\"Long\", EAST]"));
59: assertTrue(
60: "AXIS embeded in GEOGCS.",
61: s
62: .containsAxis("GEOGCS[\"WGS84\", AXIS[\"Long\", EAST]]"));
63: assertTrue(
64: "AXIS followed by spaces and different opening brace.",
65: s
66: .containsAxis("GEOGCS[\"WGS84\", AXIS (\"Long\", EAST)]"));
67: assertTrue(
68: "AXIS in mixed cases.",
69: s
70: .containsAxis("GEOGCS[\"WGS84\", aXis[\"Long\", EAST]]"));
71: assertFalse("AXIS in quoted text.", s
72: .containsAxis("GEOGCS[\"AXIS\"]"));
73: assertFalse("AXIS without opening bracket.", s
74: .containsAxis("GEOGCS[\"WGS84\", AXIS]"));
75: assertFalse("No AXIS.", s.containsAxis("GEOGCS[\"WGS84\"]"));
76: }
77: }
|