-
Notifications
You must be signed in to change notification settings - Fork 578
/
ClassPathBuilderTest.java
36 lines (29 loc) · 1.22 KB
/
ClassPathBuilderTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package edu.umd.cs.findbugs.classfile.impl;
import edu.umd.cs.findbugs.AppVersion;
import edu.umd.cs.findbugs.BugCollection;
import edu.umd.cs.findbugs.test.SpotBugsRule;
import org.junit.Rule;
import org.junit.Test;
import java.nio.file.Paths;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
public class ClassPathBuilderTest {
@Rule
public SpotBugsRule analyzer = new SpotBugsRule();
@Test
public void nestedTraversalDisabled() {
BugCollection results = analyzer.performAnalysis((engine) -> {
engine.setScanNestedArchives(false);
engine.setNoClassOk(true);
}, Paths.get("../spotbugsTestCases/archives/nestedArchive.jar"));
AppVersion appInformation = results.getCurrentAppVersion();
assertThat(appInformation.getNumClasses(), equalTo(0));
}
@Test
public void nestedTraversalEnabled() {
BugCollection results = analyzer.performAnalysis((engine) -> engine.setScanNestedArchives(true),
Paths.get("../spotbugsTestCases/archives/nestedArchive.jar"));
AppVersion appInformation = results.getCurrentAppVersion();
assertThat(appInformation.getNumClasses(), equalTo(5));
}
}