Unit tests
[vid.git] / vid-app-common / src / test / java / org / onap / vid / dao / FnAppDoaImplTest.java
1 package org.onap.vid.dao;
2
3 import java.sql.Connection;
4 import java.sql.PreparedStatement;
5 import java.sql.ResultSet;
6
7 import org.junit.Assert;
8 import org.junit.Test;
9
10 public class FnAppDoaImplTest {
11
12     private FnAppDoaImpl createTestSubject() {
13         return new FnAppDoaImpl();
14     }
15
16     @Test
17     public void testGetConnection() throws Exception {
18         String driver2 = "";
19         String url = "";
20         String username = "";
21         String password = "";
22         Connection result;
23
24         // test 1
25         url = null;
26         username = null;
27         password = null;
28         result = FnAppDoaImpl.getConnection(driver2, url, username, password);
29         Assert.assertEquals(null, result);
30
31         // test 2
32         url = "";
33         username = null;
34         password = null;
35         result = FnAppDoaImpl.getConnection(driver2, url, username, password);
36         Assert.assertEquals(null, result);
37
38         // test 3
39         username = null;
40         url = null;
41         password = null;
42         result = FnAppDoaImpl.getConnection(driver2, url, username, password);
43         Assert.assertEquals(null, result);
44
45         // test 4
46         username = "";
47         url = null;
48         password = null;
49         result = FnAppDoaImpl.getConnection(driver2, url, username, password);
50         Assert.assertEquals(null, result);
51
52         // test 5
53         password = null;
54         url = null;
55         username = null;
56         result = FnAppDoaImpl.getConnection(driver2, url, username, password);
57         Assert.assertEquals(null, result);
58
59         // test 6
60         password = "";
61         url = null;
62         username = null;
63         result = FnAppDoaImpl.getConnection(driver2, url, username, password);
64         Assert.assertEquals(null, result);
65     }
66
67     @Test
68     public void testCleanup() throws Exception {
69         ResultSet rs = null;
70         PreparedStatement st = null;
71
72         // test 1
73         rs = null;
74         FnAppDoaImpl.cleanup(rs, st, null);
75
76         // test 2
77         st = null;
78         FnAppDoaImpl.cleanup(rs, st, null);
79
80         // test 3
81         FnAppDoaImpl.cleanup(rs, st, null);
82     }
83
84     @Test
85     public void testGetProfileCount() throws Exception {
86         FnAppDoaImpl testSubject;
87         String driver = "";
88         String URL = "";
89         String username = "";
90         String password = "";
91         int result;
92
93         // default test
94         testSubject = createTestSubject();
95         result = testSubject.getProfileCount(driver, URL, username, password);
96     }
97 }