/*
* GeoTools - OpenSource mapping toolkit
* http://geotools.org
* (C) 2003-2006, Geotools Project Managment Committee (PMC)
* (C) 2001, Institut de Recherche pour le Développement
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package org.geotools.util;
// J2SE dependencies
import java.util.logging.Logger;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.geotools.resources.Arguments;
/**
* Test the {@link MonolineFormatter} class.
*
* @source $URL$
* @version $Id$
* @author Martin Desruisseaux
*/
public class MonolineFormatterTest extends TestCase {
/**
* Returns the test suite.
*/
public static Test suite() {
return new TestSuite(MonolineFormatterTest.class);
}
/**
* Constructs a test case with the given name.
*/
public MonolineFormatterTest(final String name) {
super(name);
}
/**
* Set to true
if this is run has a JUnit test
* (i.e. not from the command line).
*/
private static boolean runFromJUnit;
/**
* Set up common objects used for all tests. This initialization is performed by
* JUnit, but is not performed when the test is run from the
* command line. Instead, the initialization on command line is controled by
* the optional "-init" argument.
*/
protected void setUp() throws Exception {
runFromJUnit = true;
super.setUp();
MonolineFormatter.init("org.geotools");
}
/**
* Run the test. This is only a visual test.
*/
public void testInitialization() {
if (runFromJUnit) {
// Avoid polluting the output stream during JUnit tests.
return;
}
final String[] namespaces = {
"org.geotools.core",
"org.geotools.resources",
"org.geotools.referencing",
"org.opengis.referencing" // Non-geotools logger should not be affected.
};
for (int i=0; i-init option was explicitely specified on the command line.
* Otherwise, GeotoolsHandler
will be used only if declared in
* jre/lib/logging.properties
.
*/
public static void main(final String[] args) {
final Arguments arguments = new Arguments(args);
if (arguments.getFlag("-init")) {
MonolineFormatter.init("org.geotools");
}
if (arguments.getFlag("-geotools")) {
MonolineFormatter.initGeotools();
}
arguments.getRemainingArguments(0);
new MonolineFormatterTest(null).testInitialization();
}
}