From d5ec7bf55217508e2b5cebe640d586598379f97a Mon Sep 17 00:00:00 2001 From: "Sonsino, Ofir (os0695)" Date: Tue, 13 Mar 2018 18:31:21 +0200 Subject: Unit tests Change-Id: Ib9f73b7ba5a509610896b8bbdc02c180e60ee959 Issue-ID: VID-197 Signed-off-by: Sonsino, Ofir (os0695) --- .../java/org/onap/vid/dao/FnAppDoaImplTest.java | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 vid-app-common/src/test/java/org/onap/vid/dao/FnAppDoaImplTest.java (limited to 'vid-app-common/src/test/java/org/onap/vid/dao/FnAppDoaImplTest.java') diff --git a/vid-app-common/src/test/java/org/onap/vid/dao/FnAppDoaImplTest.java b/vid-app-common/src/test/java/org/onap/vid/dao/FnAppDoaImplTest.java new file mode 100644 index 00000000..843883cd --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/dao/FnAppDoaImplTest.java @@ -0,0 +1,97 @@ +package org.onap.vid.dao; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; + +import org.junit.Assert; +import org.junit.Test; + +public class FnAppDoaImplTest { + + private FnAppDoaImpl createTestSubject() { + return new FnAppDoaImpl(); + } + + @Test + public void testGetConnection() throws Exception { + String driver2 = ""; + String url = ""; + String username = ""; + String password = ""; + Connection result; + + // test 1 + url = null; + username = null; + password = null; + result = FnAppDoaImpl.getConnection(driver2, url, username, password); + Assert.assertEquals(null, result); + + // test 2 + url = ""; + username = null; + password = null; + result = FnAppDoaImpl.getConnection(driver2, url, username, password); + Assert.assertEquals(null, result); + + // test 3 + username = null; + url = null; + password = null; + result = FnAppDoaImpl.getConnection(driver2, url, username, password); + Assert.assertEquals(null, result); + + // test 4 + username = ""; + url = null; + password = null; + result = FnAppDoaImpl.getConnection(driver2, url, username, password); + Assert.assertEquals(null, result); + + // test 5 + password = null; + url = null; + username = null; + result = FnAppDoaImpl.getConnection(driver2, url, username, password); + Assert.assertEquals(null, result); + + // test 6 + password = ""; + url = null; + username = null; + result = FnAppDoaImpl.getConnection(driver2, url, username, password); + Assert.assertEquals(null, result); + } + + @Test + public void testCleanup() throws Exception { + ResultSet rs = null; + PreparedStatement st = null; + + // test 1 + rs = null; + FnAppDoaImpl.cleanup(rs, st, null); + + // test 2 + st = null; + FnAppDoaImpl.cleanup(rs, st, null); + + // test 3 + FnAppDoaImpl.cleanup(rs, st, null); + } + + @Test + public void testGetProfileCount() throws Exception { + FnAppDoaImpl testSubject; + String driver = ""; + String URL = ""; + String username = ""; + String password = ""; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProfileCount(driver, URL, username, password); + } +} \ No newline at end of file -- cgit 1.2.3-korg