mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-23 17:41:28 +01:00
updated tests to fix issues with the analyzer disabling themselves
Former-commit-id: 8286f053801efa11e10d3ea07529444a585859b8
This commit is contained in:
@@ -54,8 +54,7 @@ public class AssemblyAnalyzerTest {
|
|||||||
public void setUp() {
|
public void setUp() {
|
||||||
try {
|
try {
|
||||||
analyzer = new AssemblyAnalyzer();
|
analyzer = new AssemblyAnalyzer();
|
||||||
//trick the analyzer into thinking it is active, otherwise the initialize will do nothing.
|
analyzer.setEnabled(true);
|
||||||
analyzer.supportsExtension("dll");
|
|
||||||
analyzer.initialize();
|
analyzer.initialize();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.log(Level.WARNING, "Exception setting up AssemblyAnalyzer. Tests will be incomplete", e);
|
LOGGER.log(Level.WARNING, "Exception setting up AssemblyAnalyzer. Tests will be incomplete", e);
|
||||||
|
|||||||
@@ -17,39 +17,43 @@
|
|||||||
*/
|
*/
|
||||||
package org.owasp.dependencycheck.analyzer;
|
package org.owasp.dependencycheck.analyzer;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class NuspecAnalyzerTest {
|
public class NuspecAnalyzerTest {
|
||||||
private NuspecAnalyzer instance;
|
|
||||||
|
|
||||||
@Before
|
private NuspecAnalyzer instance;
|
||||||
public void setUp() {
|
|
||||||
instance = new NuspecAnalyzer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Before
|
||||||
public void testGetAnalyzerName() {
|
public void setUp() {
|
||||||
assertEquals("Nuspec Analyzer", instance.getName());
|
instance = new NuspecAnalyzer();
|
||||||
}
|
instance.setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSupportedExtensions() {
|
public void testGetAnalyzerName() {
|
||||||
assertTrue(instance.getSupportedExtensions().contains("nuspec"));
|
assertEquals("Nuspec Analyzer", instance.getName());
|
||||||
assertFalse(instance.getSupportedExtensions().contains("nupkg"));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSupportsExtension() {
|
public void testGetSupportedExtensions() {
|
||||||
assertTrue(instance.supportsExtension("nuspec"));
|
assertTrue(instance.getSupportedExtensions().contains("nuspec"));
|
||||||
assertFalse(instance.supportsExtension("nupkg"));
|
assertFalse(instance.getSupportedExtensions().contains("nupkg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAnalysisPhaze() {
|
public void testSupportsExtension() {
|
||||||
assertEquals(AnalysisPhase.INFORMATION_COLLECTION, instance.getAnalysisPhase());
|
assertTrue(instance.supportsExtension("nuspec"));
|
||||||
}
|
assertFalse(instance.supportsExtension("nupkg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetAnalysisPhaze() {
|
||||||
|
assertEquals(AnalysisPhase.INFORMATION_COLLECTION, instance.getAnalysisPhase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: cc=120:sw=4:ts=4:sts=4
|
// vim: cc=120:sw=4:ts=4:sts=4
|
||||||
|
|||||||
Reference in New Issue
Block a user