1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.owasp.dependencycheck.analyzer;
17
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertTrue;
20 import org.junit.Test;
21 import org.owasp.dependencycheck.Engine;
22 import org.owasp.dependencycheck.dependency.Dependency;
23
24
25
26
27
28 public class FalsePositiveAnalyzerTest {
29
30
31
32
33 @Test
34 public void testGetName() {
35 FalsePositiveAnalyzer instance = new FalsePositiveAnalyzer();
36 String expResult = "False Positive Analyzer";
37 String result = instance.getName();
38 assertEquals(expResult, result);
39 }
40
41
42
43
44 @Test
45 public void testGetAnalysisPhase() {
46 FalsePositiveAnalyzer instance = new FalsePositiveAnalyzer();
47 AnalysisPhase expResult = AnalysisPhase.POST_IDENTIFIER_ANALYSIS;
48 AnalysisPhase result = instance.getAnalysisPhase();
49 assertEquals(expResult, result);
50 }
51
52
53
54
55 @Test
56 public void testAnalyze() throws Exception {
57 Dependency dependency = new Dependency();
58 dependency.setFileName("pom.xml");
59 dependency.setFilePath("pom.xml");
60 dependency.addIdentifier("cpe", "cpe:/a:file:file:1.2.1", "http://some.org/url");
61 Engine engine = null;
62 FalsePositiveAnalyzer instance = new FalsePositiveAnalyzer();
63 int before = dependency.getIdentifiers().size();
64 instance.analyze(dependency, engine);
65 int after = dependency.getIdentifiers().size();
66 assertTrue(before > after);
67 }
68
69 }