improved test case so that the driver is retrieved to ensure the DriverManager registered the driver correctly

Former-commit-id: d66e20fd2c0a74f6a589702ccbf0d136c413921c
This commit is contained in:
Jeremy Long
2014-01-13 06:55:27 -05:00
parent 9e6e6701be
commit 66c3450d46

View File

@@ -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);
}
/**