codacy recommended updates

This commit is contained in:
Jeremy Long
2017-02-17 19:03:53 -05:00
parent 0d72471502
commit 3577949425
25 changed files with 493 additions and 508 deletions

View File

@@ -41,7 +41,7 @@ public class ArchiveAnalyzerIntegrationTest extends BaseDBTestCase {
@Test
public void testSupportsExtensions() {
ArchiveAnalyzer instance = new ArchiveAnalyzer();
Set<String> expResult = new HashSet<String>();
Set<String> expResult = new HashSet<>();
expResult.add("zip");
expResult.add("war");
expResult.add("ear");
@@ -114,6 +114,8 @@ public class ArchiveAnalyzerIntegrationTest extends BaseDBTestCase {
/**
* Test of analyze method, of class ArchiveAnalyzer.
*
* @throws java.lang.Exception when an error occurs
*/
@Test
public void testAnalyze() throws Exception {
@@ -171,7 +173,7 @@ public class ArchiveAnalyzerIntegrationTest extends BaseDBTestCase {
instance.close();
}
}
/**
* Test of analyze method, of class ArchiveAnalyzer.
*/

View File

@@ -17,6 +17,7 @@
*/
package org.owasp.dependencycheck.data.nvdcve;
import java.sql.SQLException;
import org.owasp.dependencycheck.BaseDBTestCase;
import org.owasp.dependencycheck.dependency.Vulnerability;
import org.owasp.dependencycheck.dependency.VulnerableSoftware;
@@ -31,6 +32,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
*
@@ -42,12 +44,14 @@ public class CveDBIntegrationTest extends BaseDBTestCase {
* Pretty useless tests of open, commit, and close methods, of class CveDB.
*/
@Test
public void testOpen() throws Exception {
public void testOpen() {
CveDB instance = null;
try {
instance = new CveDB();
instance.open();
instance.commit();
} catch (DatabaseException | SQLException ex) {
fail(ex.getMessage());
} finally {
if (instance != null) {
instance.close();

View File

@@ -131,7 +131,7 @@ public class DriverLoaderTest extends BaseTest {
File driver = new File(testClassPath, "../../src/test/resources/mysql-connector-java-5.1.27-bin.jar");
assertTrue("MySQL Driver JAR file not found in src/test/resources?", driver.isFile());
Driver d = DriverLoader.load(className, driver.getAbsolutePath());
DriverLoader.load(className, driver.getAbsolutePath());
}
/**

View File

@@ -36,9 +36,6 @@ import org.owasp.dependencycheck.utils.Settings;
*/
public class DownloadTaskTest extends BaseTest {
public DownloadTaskTest() {
}
/**
* Test of call method, of class DownloadTask.
*/

View File

@@ -218,7 +218,7 @@ public class DependencyTest extends BaseTest {
instance.getProductEvidence().addEvidence("used", "used", "used", Confidence.HIGH);
instance.getProductEvidence().addEvidence("not", "not", "not", Confidence.MEDIUM);
for (Evidence e : instance.getProductEvidence().iterator(Confidence.HIGH)) {
String use = e.getValue();
e.getValue();
}
EvidenceCollection result = instance.getEvidenceUsed();

View File

@@ -71,9 +71,10 @@ public class ModelTest extends BaseTest {
*/
@Test
public void testSetOrganization() {
String organization = "";
String organization = "apache";
Model instance = new Model();
instance.setOrganization(organization);
assertEquals("apache", instance.getOrganization());
}
/**
@@ -188,9 +189,10 @@ public class ModelTest extends BaseTest {
*/
@Test
public void testSetParentGroupId() {
String parentGroupId = "";
String parentGroupId = "org.owasp";
Model instance = new Model();
instance.setParentGroupId(parentGroupId);
assertEquals("org.owasp", instance.getParentGroupId());
}
/**