View Javadoc
1   /*
2    * This file is part of dependency-check-core.
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   * Copyright (c) 2015 Jeremy Long. All Rights Reserved.
17   */
18  package org.owasp.dependencycheck.data.update;
19  
20  import org.junit.Test;
21  import org.owasp.dependencycheck.BaseDBTestCase;
22  import org.owasp.dependencycheck.data.nvdcve.CveDB;
23  import org.owasp.dependencycheck.data.nvdcve.DatabaseProperties;
24  import org.owasp.dependencycheck.data.update.exception.UpdateException;
25  
26  import static org.junit.Assert.assertEquals;
27  import static org.junit.Assert.assertTrue;
28  
29  /**
30   *
31   * @author Jeremy Long
32   */
33  public class BaseUpdaterTest extends BaseDBTestCase {
34  
35      /**
36       * Test of getCveDB method, of class BaseUpdater.
37       */
38      @Test
39      public void testGetCveDB() {
40          BaseUpdater instance = new BaseUpdaterImpl();
41          CveDB expResult = null;
42          CveDB result = instance.getCveDB();
43          assertEquals(expResult, result);
44      }
45  
46      /**
47       * Test of getProperties method, of class BaseUpdater.
48       */
49      @Test
50      public void testGetProperties() throws UpdateException {
51          BaseUpdater instance = null;
52          try {
53              instance = new BaseUpdaterImpl();
54              instance.openDataStores();
55  
56              DatabaseProperties result = instance.getProperties();
57              assertTrue(result.getProperties().keySet().size() > 1);
58          } finally {
59              if (instance != null) {
60                  instance.closeDataStores();
61              }
62          }
63      }
64  
65      /**
66       * Test of closeDataStores method, of class BaseUpdater.
67       */
68      @Test
69      public void testCloseDataStores() throws UpdateException {
70          BaseUpdater instance = null;
71          try {
72              instance = new BaseUpdaterImpl();
73              instance.openDataStores();
74          } finally {
75              if (instance != null) {
76                  instance.closeDataStores();
77              }
78          }
79      }
80  
81      /**
82       * Test of openDataStores method, of class BaseUpdater.
83       */
84      @Test
85      public void testOpenDataStores() throws Exception {
86          BaseUpdater instance = null;
87          try {
88              instance = new BaseUpdaterImpl();
89              instance.openDataStores();
90          } finally {
91              if (instance != null) {
92                  instance.closeDataStores();
93              }
94          }
95      }
96  
97      public class BaseUpdaterImpl extends BaseUpdater {
98      }
99  
100 }