added test cases to CachedDataSource
authorSandeep J <sandeejh@in.ibm.com>
Mon, 1 Oct 2018 19:40:21 +0000 (01:10 +0530)
committerSandeep J <sandeejh@in.ibm.com>
Mon, 1 Oct 2018 19:40:39 +0000 (01:10 +0530)
to increase code coverage

Issue-ID: CCSDK-595
Change-Id: I7d5a5ed59538e7d6e1a7d00dfba690eedc7c2e22
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceTest.java

index c463f38..4526810 100644 (file)
@@ -1,10 +1,12 @@
 package org.onap.ccsdk.sli.core.dblib;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
+import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 import java.util.Properties;
 
@@ -94,4 +96,26 @@ public class CachedDataSourceTest {
                assertEquals("passw0rd", ((JdbcDBCachedDataSource) ds).getDbPasswd());
                assertEquals("testdb01", ((JdbcDBCachedDataSource) ds).toString());
        }
+
+       @Test
+       public void testIsInitialised() {
+               assertTrue(ds.isInitialized());
+       }
+
+       @Test
+       public void testIsWrapperFor() throws SQLException {
+               assertFalse(ds.isWrapperFor(CachedDataSource.class));
+       }
+
+       @Test
+       public void testGetSetNextErrorReportTime() throws SQLException {
+               ds.setNextErrorReportTime(1L);
+               assertEquals(1L, ds.getNextErrorReportTime());
+       }
+
+       @Test
+       public void testGetSetGlobalHostName() throws SQLException {
+               ds.setGlobalHostName("hostName");
+               assertEquals("hostName", ds.getGlobalHostName());
+       }
 }
\ No newline at end of file