X-Git-Url: http://jaekl.net/gitweb/?p=cfb.git;a=blobdiff_plain;f=test%2Fnet%2Fjaekl%2Fcfb%2Fanalyze%2FAnalyzerTest.java;h=85bd3d2950dcc26044d77c3e1989ae5e29a98910;hp=9691efa9b2196c0df43c418ccd58a0772ae0abd3;hb=3c10b6100c6035a65ce37dea846b027135289f67;hpb=88c635ae6a039a873cba2d794c55d726dcdc616d
diff --git a/test/net/jaekl/cfb/analyze/AnalyzerTest.java b/test/net/jaekl/cfb/analyze/AnalyzerTest.java
index 9691efa..85bd3d2 100644
--- a/test/net/jaekl/cfb/analyze/AnalyzerTest.java
+++ b/test/net/jaekl/cfb/analyze/AnalyzerTest.java
@@ -1,57 +1,12 @@
package net.jaekl.cfb.analyze;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
-import java.io.ByteArrayInputStream;
import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.HashMap;
-
-import net.jaekl.cfb.xml.BugCollection;
-import net.jaekl.cfb.xml.BugInstance;
-import net.jaekl.qd.xml.XmlParseException;
import org.junit.Test;
-import org.xml.sax.InputSource;
public class AnalyzerTest {
- private static final String UTF8 = "utf-8";
-
- private static final String SAMPLE1_XML = ""
- + "\n"
- + "\n"
- + "\n"
- + "/home/chris/prog/././cfb/bin\n"
- + "/home/chris/prog/././cfb/src\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n"
- + "\n";
-
@Test
public void testOutputWorkFile() {
final String[][] DATA = {
@@ -71,41 +26,13 @@ public class AnalyzerTest {
File fbp = new File(datum[2]);
File expected = new File(datum[3]);
- Analyzer analyzer = new Analyzer(findBugsDir);
+ MessageMapMock mmm = new MessageMapMock();
+ mmm.mock_setFindBugsDir(findBugsDir);
+
+ Analyzer analyzer = new Analyzer(mmm);
File actual = analyzer.outputWorkFile(workDir, fbp);
assertEquals(expected.getAbsolutePath(), actual.getAbsolutePath());
}
}
- @Test
- public void testParseSample1() throws IOException, XmlParseException {
- Charset utf8 = Charset.forName(UTF8);
- BugInstance inst = null;
-
- try ( ByteArrayInputStream bais = new ByteArrayInputStream(SAMPLE1_XML.getBytes(utf8)))
- {
- InputSource inputSource = new InputSource(bais);
- Analyzer analyzer = new Analyzer(new File("."));
- Analysis analysis = analyzer.parseFbOutput(inputSource);
-
- assertNotNull(analysis);
-
- BugCollection bugColl = analysis.getBugCollection();
-
- assertNotNull(bugColl);
- assertEquals(2, bugColl.size());
-
- HashMap typeMap = new HashMap();
- for (int idx = 0; idx < bugColl.size(); ++idx) {
- inst = bugColl.get(idx);
- typeMap.put(inst.getType(), inst);
- }
-
- inst = typeMap.get("DM_DEFAULT_ENCODING");
- assertNotNull(inst);
-
- inst = typeMap.get("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE");
- assertNotNull(inst);
- }
- }
}