01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2005-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; 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.resources;
17:
18: // J2SE dependencies
19: import java.util.Locale;
20:
21: // JUnit dependencies
22: import junit.framework.Test;
23: import junit.framework.TestCase;
24: import junit.framework.TestSuite;
25:
26: // Geotools dependencies
27: import org.geotools.resources.i18n.Vocabulary;
28: import org.geotools.resources.i18n.VocabularyKeys;
29:
30: /**
31: * Tests the {@link ResourceBundle} class, especially {@link Vocabulary}.
32: *
33: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/metadata/src/test/java/org/geotools/resources/ResourceBundleTest.java $
34: * @version $Id: ResourceBundleTest.java 24576 2007-02-24 00:07:40Z desruisseaux $
35: * @author Martin Desruisseaux
36: */
37: public final class ResourceBundleTest extends TestCase {
38: /**
39: * Run the test from the command line.
40: */
41: public static void main(String[] args) {
42: junit.textui.TestRunner.run(suite());
43: }
44:
45: /**
46: * Returns the test suite.
47: */
48: public static Test suite() {
49: return new TestSuite(ResourceBundleTest.class);
50: }
51:
52: /**
53: * Constructs a test case with the given name.
54: */
55: public ResourceBundleTest(String name) {
56: super (name);
57: }
58:
59: /**
60: * Tests some simple vocabulary words.
61: */
62: public void testVocabulary() {
63: Vocabulary resources;
64:
65: resources = Vocabulary.getResources(Locale.ENGLISH);
66: assertSame(resources, Vocabulary.getResources(Locale.US));
67: assertSame(resources, Vocabulary.getResources(Locale.UK));
68: assertSame(resources, Vocabulary.getResources(Locale.CANADA));
69: assertEquals("North", resources.getString(VocabularyKeys.NORTH));
70:
71: resources = Vocabulary.getResources(Locale.FRENCH);
72: assertSame(resources, Vocabulary.getResources(Locale.FRANCE));
73: assertSame(resources, Vocabulary
74: .getResources(Locale.CANADA_FRENCH));
75: assertEquals("Nord", resources.getString(VocabularyKeys.NORTH));
76: }
77: }
|