KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > junit > ChangeConfigurationSetup


1 /*
2  *
3  * Derby - Class org.apache.derbyTesting.junit.ChangeConfigurationSetup
4  *
5  * Licensed to the Apache Software Foundation (ASF) under one or more
6  * contributor license agreements. See the NOTICE file distributed with
7  * this work for additional information regarding copyright ownership.
8  * The ASF licenses this file to You under the Apache License, Version 2.0
9  * (the "License"); you may not use this file except in compliance with
10  * the License. You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */

20 package org.apache.derbyTesting.junit;
21
22 import junit.extensions.TestSetup;
23 import junit.framework.Test;
24
25 final class ChangeConfigurationSetup extends TestSetup {
26     
27     private final TestConfiguration config;
28     private TestConfiguration old;
29     
30     ChangeConfigurationSetup(TestConfiguration config, Test test)
31     {
32         super(test);
33         this.config = config;
34     }
35     
36     protected void setUp()
37     {
38         old = TestConfiguration.getCurrent();
39         TestConfiguration.setCurrent(config);
40     }
41     
42     protected void tearDown()
43     {
44         TestConfiguration.setCurrent(old);
45     }
46 }
47
Popular Tags