mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-20 08:14:44 +01:00
redirected standard error to hide expected [fatal] message from being displayed during tests
Former-commit-id: ecbc294640ca1e1a3c418af871dd71a31bbcccdb
This commit is contained in:
@@ -17,11 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.owasp.dependencycheck.data.nuget;
|
package org.owasp.dependencycheck.data.nuget;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -29,6 +29,7 @@ import static org.junit.Assert.*;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class XPathNuspecParserTest {
|
public class XPathNuspecParserTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test all the valid components.
|
* Test all the valid components.
|
||||||
*
|
*
|
||||||
@@ -56,6 +57,11 @@ public class XPathNuspecParserTest {
|
|||||||
public void testMissingDocument() throws Exception {
|
public void testMissingDocument() throws Exception {
|
||||||
NuspecParser parser = new XPathNuspecParser();
|
NuspecParser parser = new XPathNuspecParser();
|
||||||
InputStream is = XPathNuspecParserTest.class.getClassLoader().getResourceAsStream("dependencycheck.properties");
|
InputStream is = XPathNuspecParserTest.class.getClassLoader().getResourceAsStream("dependencycheck.properties");
|
||||||
|
|
||||||
|
//hide the fatal message from the core parser
|
||||||
|
final ByteArrayOutputStream myOut = new ByteArrayOutputStream();
|
||||||
|
System.setErr(new PrintStream(myOut));
|
||||||
|
|
||||||
NugetPackage np = parser.parse(is);
|
NugetPackage np = parser.parse(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user