updated tests to fix issues with the analyzer disabling themselves

Former-commit-id: 8286f053801efa11e10d3ea07529444a585859b8
This commit is contained in:
Jeremy Long
2014-03-23 00:36:54 -04:00
parent b2a5963f5a
commit 9aa6ad216d
2 changed files with 29 additions and 26 deletions

View File

@@ -54,8 +54,7 @@ public class AssemblyAnalyzerTest {
public void setUp() {
try {
analyzer = new AssemblyAnalyzer();
//trick the analyzer into thinking it is active, otherwise the initialize will do nothing.
analyzer.supportsExtension("dll");
analyzer.setEnabled(true);
analyzer.initialize();
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Exception setting up AssemblyAnalyzer. Tests will be incomplete", e);

View File

@@ -17,39 +17,43 @@
*/
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.Test;
import static org.junit.Assert.*;
public class NuspecAnalyzerTest {
private NuspecAnalyzer instance;
@Before
public void setUp() {
instance = new NuspecAnalyzer();
}
private NuspecAnalyzer instance;
@Test
public void testGetAnalyzerName() {
assertEquals("Nuspec Analyzer", instance.getName());
}
@Before
public void setUp() {
instance = new NuspecAnalyzer();
instance.setEnabled(true);
}
@Test
public void testGetSupportedExtensions() {
assertTrue(instance.getSupportedExtensions().contains("nuspec"));
assertFalse(instance.getSupportedExtensions().contains("nupkg"));
}
@Test
public void testGetAnalyzerName() {
assertEquals("Nuspec Analyzer", instance.getName());
}
@Test
public void testSupportsExtension() {
assertTrue(instance.supportsExtension("nuspec"));
assertFalse(instance.supportsExtension("nupkg"));
}
@Test
public void testGetSupportedExtensions() {
assertTrue(instance.getSupportedExtensions().contains("nuspec"));
assertFalse(instance.getSupportedExtensions().contains("nupkg"));
}
@Test
public void testGetAnalysisPhaze() {
assertEquals(AnalysisPhase.INFORMATION_COLLECTION, instance.getAnalysisPhase());
}
@Test
public void testSupportsExtension() {
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