Add code to load bug categories and patterns from the FindBugs messages.xml file.
[cfb.git] / test / net / jaekl / cfb / analyze / AnalyzerTest.java
1 package net.jaekl.cfb.analyze;
2
3 import static org.junit.Assert.assertEquals;
4
5 import java.io.File;
6
7 import org.junit.Test;
8
9 public class AnalyzerTest {
10         @Test
11         public void testOutputWorkFile() {
12                 final String[][] DATA = {
13                                 // findBugsDir, workDir, FBP,        expectedOutputXml
14                                 { "foo",        "bar",   "baz.fbp",  "bar" + File.separator + "baz.xml" },
15                                 { 
16                                         File.separator + "findbugs-3.01",
17                                         "." + File.separator + "work",
18                                         "project.fbp",
19                                         "." + File.separator + "work" + File.separator + "project.xml"
20                                 }
21                         };
22                 
23                 for (String[] datum : DATA) {
24                         File findBugsDir = new File(datum[0]);
25                         File workDir     = new File(datum[1]);
26                         File fbp         = new File(datum[2]);
27                         File expected    = new File(datum[3]);
28
29                         MessageMapMock mmm = new MessageMapMock();
30                         mmm.mock_setFindBugsDir(findBugsDir);
31
32                         Analyzer analyzer = new Analyzer(mmm);
33                         File actual = analyzer.outputWorkFile(workDir, fbp);
34                         assertEquals(expected.getAbsolutePath(), actual.getAbsolutePath());
35                 }
36         }
37
38 }