01: package test.net.sourceforge.pmd.renderers;
02:
03: import net.sourceforge.pmd.PMD;
04: import net.sourceforge.pmd.Report.ProcessingError;
05: import net.sourceforge.pmd.renderers.AbstractRenderer;
06: import net.sourceforge.pmd.renderers.SummaryHTMLRenderer;
07:
08: public class SummaryHTMLRendererTest extends AbstractRendererTst {
09:
10: public AbstractRenderer getRenderer() {
11: return new SummaryHTMLRenderer();
12: }
13:
14: public String getExpected() {
15: return "<html><head><title>PMD</title></head><body>"
16: + PMD.EOL
17: + "<h2><center>Summary</h2></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><th>Rule name</th><th>Number of violations</th><tr><td>Foo</td><td align=center>1</td></tr></table><h2><center>Detail</h2></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
18: + PMD.EOL
19: + "<center><h3>PMD report</h3></center><center><h3>Problems found</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
20: + PMD.EOL
21: + "<th>#</th><th>File</th><th>Line</th><th>Problem</th></tr>"
22: + PMD.EOL + "<tr bgcolor=\"lightgrey\"> " + PMD.EOL
23: + "<td align=\"center\">1</td>" + PMD.EOL
24: + "<td width=\"*%\">n/a</td>" + PMD.EOL
25: + "<td align=\"center\" width=\"5%\">1</td>" + PMD.EOL
26: + "<td width=\"*\">msg</td>" + PMD.EOL + "</tr>"
27: + PMD.EOL + "</table></table></body></html>";
28:
29: }
30:
31: public String getExpectedEmpty() {
32: return "<html><head><title>PMD</title></head><body>"
33: + PMD.EOL
34: + "<h2><center>Summary</h2></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><th>Rule name</th><th>Number of violations</th></table><h2><center>Detail</h2></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
35: + PMD.EOL
36: + "<center><h3>PMD report</h3></center><center><h3>Problems found</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
37: + PMD.EOL
38: + "<th>#</th><th>File</th><th>Line</th><th>Problem</th></tr>"
39: + PMD.EOL + "</table></table></body></html>";
40: }
41:
42: public String getExpectedMultiple() {
43: return "<html><head><title>PMD</title></head><body>"
44: + PMD.EOL
45: + "<h2><center>Summary</h2></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><th>Rule name</th><th>Number of violations</th><tr><td>Foo</td><td align=center>2</td></tr></table><h2><center>Detail</h2></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
46: + PMD.EOL
47: + "<center><h3>PMD report</h3></center><center><h3>Problems found</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
48: + PMD.EOL
49: + "<th>#</th><th>File</th><th>Line</th><th>Problem</th></tr>"
50: + PMD.EOL + "<tr bgcolor=\"lightgrey\"> " + PMD.EOL
51: + "<td align=\"center\">1</td>" + PMD.EOL
52: + "<td width=\"*%\">n/a</td>" + PMD.EOL
53: + "<td align=\"center\" width=\"5%\">1</td>" + PMD.EOL
54: + "<td width=\"*\">msg</td>" + PMD.EOL + "</tr>"
55: + PMD.EOL + "<tr> " + PMD.EOL
56: + "<td align=\"center\">2</td>" + PMD.EOL
57: + "<td width=\"*%\">n/a</td>" + PMD.EOL
58: + "<td align=\"center\" width=\"5%\">1</td>" + PMD.EOL
59: + "<td width=\"*\">msg</td>" + PMD.EOL + "</tr>"
60: + PMD.EOL + "</table></table></body></html>";
61: }
62:
63: public String getExpectedError(ProcessingError error) {
64: return "<html><head><title>PMD</title></head><body>"
65: + PMD.EOL
66: + "<h2><center>Summary</h2></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><th>Rule name</th><th>Number of violations</th></table><h2><center>Detail</h2></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
67: + PMD.EOL
68: + "<center><h3>PMD report</h3></center><center><h3>Problems found</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
69: + PMD.EOL
70: + "<th>#</th><th>File</th><th>Line</th><th>Problem</th></tr>"
71: + PMD.EOL
72: + "</table><hr/><center><h3>Processing errors</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
73: + PMD.EOL + "<th>File</th><th>Problem</th></tr>"
74: + PMD.EOL + "<tr bgcolor=\"lightgrey\"> " + PMD.EOL
75: + "<td>file</td>" + PMD.EOL + "<td>Error</td>"
76: + PMD.EOL + "</tr>" + PMD.EOL
77: + "</table></table></body></html>";
78: }
79:
80: public static junit.framework.Test suite() {
81: return new junit.framework.JUnit4TestAdapter(
82: SummaryHTMLRendererTest.class);
83: }
84: }
|