From 7a5a5e0211cedb6f07a3ec9fae9d09e508f57c2a Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Sun, 14 Jun 2015 16:07:44 -0400 Subject: [PATCH] added the hint analyzer to the test case to fix a bug Former-commit-id: 48062285772215509e00ff74a0d3dcf83f571cb9 --- .../analyzer/CPEAnalyzerIntegrationTest.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.java b/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.java index 461fe0d46..2214c4d3b 100644 --- a/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.java +++ b/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/CPEAnalyzerIntegrationTest.java @@ -147,23 +147,29 @@ public class CPEAnalyzerIntegrationTest extends AbstractDatabaseTestCase { FileNameAnalyzer fnAnalyzer = new FileNameAnalyzer(); fnAnalyzer.analyze(struts, null); + HintAnalyzer hintAnalyzer = new HintAnalyzer(); JarAnalyzer jarAnalyzer = new JarAnalyzer(); - jarAnalyzer.analyze(struts, null); + jarAnalyzer.supportsExtension("jar"); + jarAnalyzer.analyze(struts, null); + hintAnalyzer.analyze(struts, null); //File fileCommonValidator = new File(this.getClass().getClassLoader().getResource("commons-validator-1.4.0.jar").getPath()); File fileCommonValidator = BaseTest.getResourceAsFile(this, "commons-validator-1.4.0.jar"); Dependency commonValidator = new Dependency(fileCommonValidator); jarAnalyzer.analyze(commonValidator, null); + hintAnalyzer.analyze(commonValidator, null); //File fileSpring = new File(this.getClass().getClassLoader().getResource("spring-core-2.5.5.jar").getPath()); File fileSpring = BaseTest.getResourceAsFile(this, "spring-core-2.5.5.jar"); Dependency spring = new Dependency(fileSpring); jarAnalyzer.analyze(spring, null); + hintAnalyzer.analyze(spring, null); //File fileSpring3 = new File(this.getClass().getClassLoader().getResource("spring-core-3.0.0.RELEASE.jar").getPath()); File fileSpring3 = BaseTest.getResourceAsFile(this, "spring-core-3.0.0.RELEASE.jar"); Dependency spring3 = new Dependency(fileSpring3); jarAnalyzer.analyze(spring3, null); + hintAnalyzer.analyze(spring3, null); CPEAnalyzer instance = new CPEAnalyzer(); instance.open(); @@ -189,6 +195,7 @@ public class CPEAnalyzerIntegrationTest extends AbstractDatabaseTestCase { //the following two only work if the HintAnalyzer is used. //Assert.assertTrue("Incorrect match size - spring", spring.getIdentifiers().size() == 1); //Assert.assertTrue("Incorrect match - spring", spring.getIdentifiers().get(0).getValue().equals(expResultSpring)); + jarAnalyzer.close(); } /**