View Javadoc
1 /* 2 * Copyright (c) 2001 by 3 * Siegfried GOESCHL <mailto:siegfried.goeschl@itserv.at>; 4 * and Dima STADNIK <mailto:5d5@mail.ru>; 5 * 6 * This program is free software. 7 * 8 * You may redistribute it and/or modify it under the terms of the GNU 9 * General Public License as published by the Free Software Foundation. 10 * Version 2 of the license should be included with this distribution in 11 * the file LICENSE, as well as License.html. If the license is not 12 * included with this distribution, you may find a copy at the FSF web 13 * site at 'www.gnu.org' or 'www.fsf.org', or you may write to the 14 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139 USA. 15 * 16 * THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND, 17 * NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR 18 * OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY 19 * CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR 20 * REDISTRIBUTION OF THIS SOFTWARE. 21 */ 22 23 package test.junit.extensions; 24 25 import junit.framework.*; 26 import junit.extensions.*; 27 import junit.extensions.conf.ConfigurationFactory; 28 29 /*** 30 * Tests ConfigurableTestSetup class. 31 * 32 * @author Siegfried GOESCHL 33 * @author Dima STADNIK 34 */ 35 public class ConfigurableTestSetupTest extends ConfigurableTestCase { 36 37 public ConfigurableTestSetupTest(String name) { 38 super(name); 39 } 40 41 public static Test suite() { 42 // trigger loading the configuration file here - allows 43 // lo load all files for all test suites 44 ConfigurationFactory.init(ConfigurableTestSetupTest.class); 45 TestSuite suite= new TestSuite(); 46 // add a single test suite here 47 suite.addTest( ConfigurableTestCaseTest.suite() ); 48 // also test the configurabl test setup - we read a boolean 49 // value from the config file 50 ConfigurableTestSetup wrapper= new ConfigurableTestSetup(suite) { 51 private boolean isSetup = false; 52 private boolean isConfigFileAvailable = false; 53 public void setUp() { 54 isSetup = true; 55 // access the configuration within the TestSetup 56 isConfigFileAvailable = getBoolean( "isConfigFileAvailable" ); 57 } 58 public void tearDown() { 59 Assert.assertTrue( "setup() had to be invoked", isSetup ); 60 Assert.assertTrue( "expect TRUE from config file", isConfigFileAvailable ); 61 } 62 }; 63 return wrapper; 64 } 65 66 public static void main(String args[]) { 67 junit.textui.TestRunner.run(ConfigurableTestSetupTest.suite()); 68 } 69 }

This page was automatically generated by Maven