mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-20 00:04:27 +01:00
simplified exception testing
Former-commit-id: cf543a3ec397e593e7de2249820bd48159132413
This commit is contained in:
@@ -18,9 +18,7 @@
|
|||||||
package org.owasp.dependencycheck.analyzer;
|
package org.owasp.dependencycheck.analyzer;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
|
||||||
import org.owasp.dependencycheck.BaseTest;
|
import org.owasp.dependencycheck.BaseTest;
|
||||||
import org.owasp.dependencycheck.Engine;
|
import org.owasp.dependencycheck.Engine;
|
||||||
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
|
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
|
||||||
@@ -44,9 +42,6 @@ import static org.junit.Assert.assertNull;
|
|||||||
*/
|
*/
|
||||||
public class AbstractSuppressionAnalyzerTest extends BaseTest {
|
public class AbstractSuppressionAnalyzerTest extends BaseTest {
|
||||||
|
|
||||||
@Rule
|
|
||||||
public ExpectedException exception = ExpectedException.none();
|
|
||||||
|
|
||||||
private AbstractSuppressionAnalyzer instance;
|
private AbstractSuppressionAnalyzer instance;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -87,10 +82,9 @@ public class AbstractSuppressionAnalyzerTest extends BaseTest {
|
|||||||
assertEquals(expCount, result.size());
|
assertEquals(expCount, result.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(expected = SuppressionParseException.class)
|
||||||
public void testFailureToLocateSuppressionFileInClasspath() throws Exception {
|
public void testFailureToLocateSuppressionFileInClasspath() throws Exception {
|
||||||
Settings.setString(Settings.KEYS.SUPPRESSION_FILE, "doesnotexist.xml");
|
Settings.setString(Settings.KEYS.SUPPRESSION_FILE, "doesnotexist.xml");
|
||||||
exception.expect(SuppressionParseException.class);
|
|
||||||
instance.initialize();
|
instance.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user