1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
32
33 public class BaseUpdaterTest extends BaseDBTestCase {
34
35
36
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
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
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
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 }