mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-23 09:31:32 +01:00
fixed unit test on non-windows
This commit is contained in:
@@ -86,7 +86,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
*
|
*
|
||||||
* @return the list of arguments to begin populating the ProcessBuilder
|
* @return the list of arguments to begin populating the ProcessBuilder
|
||||||
*/
|
*/
|
||||||
private List<String> buildArgumentList() {
|
protected List<String> buildArgumentList() {
|
||||||
// Use file.separator as a wild guess as to whether this is Windows
|
// Use file.separator as a wild guess as to whether this is Windows
|
||||||
final List<String> args = new ArrayList<String>();
|
final List<String> args = new ArrayList<String>();
|
||||||
if (!SystemUtils.IS_OS_WINDOWS) {
|
if (!SystemUtils.IS_OS_WINDOWS) {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
|
|||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
import org.junit.Assume;
|
import org.junit.Assume;
|
||||||
import static org.junit.Assume.assumeFalse;
|
import static org.junit.Assume.assumeFalse;
|
||||||
|
import static org.junit.Assume.assumeNotNull;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.owasp.dependencycheck.BaseTest;
|
import org.owasp.dependencycheck.BaseTest;
|
||||||
@@ -81,7 +82,7 @@ public class AssemblyAnalyzerTest extends BaseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAnalysis() throws Exception {
|
public void testAnalysis() throws Exception {
|
||||||
//File f = new File(AssemblyAnalyzerTest.class.getClassLoader().getResource("GrokAssembly.exe").getPath());
|
assumeNotNull(analyzer.buildArgumentList());
|
||||||
File f = BaseTest.getResourceAsFile(this, "GrokAssembly.exe");
|
File f = BaseTest.getResourceAsFile(this, "GrokAssembly.exe");
|
||||||
Dependency d = new Dependency(f);
|
Dependency d = new Dependency(f);
|
||||||
analyzer.analyze(d, null);
|
analyzer.analyze(d, null);
|
||||||
@@ -104,7 +105,7 @@ public class AssemblyAnalyzerTest extends BaseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLog4Net() throws Exception {
|
public void testLog4Net() throws Exception {
|
||||||
//File f = new File(AssemblyAnalyzerTest.class.getClassLoader().getResource("log4net.dll").getPath());
|
assumeNotNull(analyzer.buildArgumentList());
|
||||||
File f = BaseTest.getResourceAsFile(this, "log4net.dll");
|
File f = BaseTest.getResourceAsFile(this, "log4net.dll");
|
||||||
|
|
||||||
Dependency d = new Dependency(f);
|
Dependency d = new Dependency(f);
|
||||||
@@ -116,9 +117,10 @@ public class AssemblyAnalyzerTest extends BaseTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNonexistent() {
|
public void testNonexistent() {
|
||||||
|
assumeNotNull(analyzer.buildArgumentList());
|
||||||
|
|
||||||
// Tweak the log level so the warning doesn't show in the console
|
// Tweak the log level so the warning doesn't show in the console
|
||||||
String oldProp = System.getProperty(LOG_KEY, "info");
|
String oldProp = System.getProperty(LOG_KEY, "info");
|
||||||
//File f = new File(AssemblyAnalyzerTest.class.getClassLoader().getResource("log4net.dll").getPath());
|
|
||||||
File f = BaseTest.getResourceAsFile(this, "log4net.dll");
|
File f = BaseTest.getResourceAsFile(this, "log4net.dll");
|
||||||
File test = new File(f.getParent(), "nonexistent.dll");
|
File test = new File(f.getParent(), "nonexistent.dll");
|
||||||
Dependency d = new Dependency(test);
|
Dependency d = new Dependency(test);
|
||||||
|
|||||||
Reference in New Issue
Block a user