View Javadoc
1   /*
2    * Copyright 2014 OWASP.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.owasp.dependencycheck;
17  
18  import org.junit.After;
19  import org.junit.Before;
20  import org.owasp.dependencycheck.utils.Settings;
21  
22  /**
23   *
24   * @author Jeremy Long
25   */
26  public abstract class BaseTest {
27  
28      /**
29       * The configured settings.
30       */
31      private Settings settings;
32  
33      /**
34       * Initialize the {@link Settings}.
35       */
36      @Before
37      public void setUp() {
38          settings = new Settings();
39      }
40  
41      /**
42       * Clean the {@link Settings}.
43       */
44      @After
45      public void tearDown() {
46          settings.cleanup(true);
47      }
48  
49      /**
50       * Returns the settings for the test cases.
51       *
52       * @return
53       */
54      protected Settings getSettings() {
55          return settings;
56      }
57  
58      protected void reloadSettings() {
59          tearDown();
60          setUp();
61      }
62  }