From 6a871c51a15c0a35bae91198286fd5183a29d21f Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Mon, 13 Jan 2014 06:55:27 -0500 Subject: [PATCH] improved test case so that the driver is retrieved to ensure the DriverManager registered the driver correctly Former-commit-id: 181f883e673c34120628a850e844fb11a7fa961b --- .../dependencycheck/data/nvdcve/DriverLoaderTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dependency-check-core/src/test/java/org/owasp/dependencycheck/data/nvdcve/DriverLoaderTest.java b/dependency-check-core/src/test/java/org/owasp/dependencycheck/data/nvdcve/DriverLoaderTest.java index fbd84aa4e..3ab599ec1 100644 --- a/dependency-check-core/src/test/java/org/owasp/dependencycheck/data/nvdcve/DriverLoaderTest.java +++ b/dependency-check-core/src/test/java/org/owasp/dependencycheck/data/nvdcve/DriverLoaderTest.java @@ -19,12 +19,15 @@ package org.owasp.dependencycheck.data.nvdcve; import java.io.File; +import java.sql.Driver; +import java.sql.DriverManager; import org.junit.After; import org.junit.AfterClass; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import static org.junit.Assert.*; /** * @@ -61,8 +64,7 @@ public class DriverLoaderTest { } /** - * Test of load method, of class DriverLoader; expecting an exception due to - * a bad driver class name. + * Test of load method, of class DriverLoader; expecting an exception due to a bad driver class name. */ @Test(expected = DriverLoadException.class) public void testLoad_String_ex() throws Exception { @@ -82,6 +84,8 @@ public class DriverLoaderTest { assertTrue("MySQL Driver JAR file not found in src/test/resources?", driver.isFile()); DriverLoader.load(className, driver.getAbsolutePath()); + Driver d = DriverManager.getDriver("jdbc:mysql://localhost:3306/dependencycheck"); + assertNotNull(d); } /**