From 2f5bc084af648187c9fcffb8ff6472f8755c034d Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Tue, 2 Oct 2018 01:10:21 +0530 Subject: added test cases to CachedDataSource to increase code coverage Issue-ID: CCSDK-595 Change-Id: I7d5a5ed59538e7d6e1a7d00dfba690eedc7c2e22 Signed-off-by: Sandeep J --- .../ccsdk/sli/core/dblib/CachedDataSourceTest.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'dblib/provider/src/test/java/org/onap') diff --git a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceTest.java b/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceTest.java index c463f38b..45268107 100644 --- a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceTest.java +++ b/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceTest.java @@ -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 -- cgit 1.2.3-korg