mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-17 23:04:07 +01:00
fixed test cases
This commit is contained in:
@@ -230,6 +230,16 @@ public final class CveDB implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method added for testing, returns the current usage count of the CveDB
|
||||
* singleton.
|
||||
*
|
||||
* @return the current usage of the CveDB singleton
|
||||
*/
|
||||
protected synchronized int getUsageCount() {
|
||||
return usageCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the database connection. If the database does not exist, it will
|
||||
* create a new one.
|
||||
|
||||
@@ -68,8 +68,10 @@ public class CveDBIT extends BaseDBTestCase {
|
||||
} catch (DatabaseException | SQLException ex) {
|
||||
fail(ex.getMessage());
|
||||
} finally {
|
||||
int start = instance.getUsageCount();
|
||||
instance.close();
|
||||
assertFalse(instance.isOpen());
|
||||
int end = instance.getUsageCount();
|
||||
assertTrue( end < start);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,10 @@ public class CveDBMySqlIT extends BaseTest {
|
||||
System.out.println("Unable to connect to the My SQL database; verify that the db server is running and that the schema has been generated");
|
||||
fail(ex.getMessage());
|
||||
} finally {
|
||||
int start = instance.getUsageCount();
|
||||
instance.close();
|
||||
assertFalse(instance.isOpen());
|
||||
int end = instance.getUsageCount();
|
||||
assertTrue( end < start);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user