mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-22 09:09:31 +01:00
improved test case so that the driver is retrieved to ensure the DriverManager registered the driver correctly
Former-commit-id: 181f883e673c34120628a850e844fb11a7fa961b
This commit is contained in:
@@ -19,12 +19,15 @@
|
|||||||
package org.owasp.dependencycheck.data.nvdcve;
|
package org.owasp.dependencycheck.data.nvdcve;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.sql.Driver;
|
||||||
|
import java.sql.DriverManager;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
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
|
* Test of load method, of class DriverLoader; expecting an exception due to a bad driver class name.
|
||||||
* a bad driver class name.
|
|
||||||
*/
|
*/
|
||||||
@Test(expected = DriverLoadException.class)
|
@Test(expected = DriverLoadException.class)
|
||||||
public void testLoad_String_ex() throws Exception {
|
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());
|
assertTrue("MySQL Driver JAR file not found in src/test/resources?", driver.isFile());
|
||||||
|
|
||||||
DriverLoader.load(className, driver.getAbsolutePath());
|
DriverLoader.load(className, driver.getAbsolutePath());
|
||||||
|
Driver d = DriverManager.getDriver("jdbc:mysql://localhost:3306/dependencycheck");
|
||||||
|
assertNotNull(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user