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.HTMLRenderer;
07:
08: public class HTMLRendererTest extends AbstractRendererTst {
09:
10: public AbstractRenderer getRenderer() {
11: return new HTMLRenderer();
12: }
13:
14: public String getExpected() {
15: return "<html><head><title>PMD</title></head><body>"
16: + PMD.EOL
17: + "<center><h3>PMD report</h3></center><center><h3>Problems found</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
18: + PMD.EOL
19: + "<th>#</th><th>File</th><th>Line</th><th>Problem</th></tr>"
20: + PMD.EOL + "<tr bgcolor=\"lightgrey\"> " + PMD.EOL
21: + "<td align=\"center\">1</td>" + PMD.EOL
22: + "<td width=\"*%\">n/a</td>" + PMD.EOL
23: + "<td align=\"center\" width=\"5%\">1</td>" + PMD.EOL
24: + "<td width=\"*\">msg</td>" + PMD.EOL + "</tr>"
25: + PMD.EOL + "</table></body></html>";
26: }
27:
28: public String getExpectedEmpty() {
29: return "<html><head><title>PMD</title></head><body>"
30: + PMD.EOL
31: + "<center><h3>PMD report</h3></center><center><h3>Problems found</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
32: + PMD.EOL
33: + "<th>#</th><th>File</th><th>Line</th><th>Problem</th></tr>"
34: + PMD.EOL + "</table></body></html>";
35: }
36:
37: public String getExpectedMultiple() {
38: return "<html><head><title>PMD</title></head><body>"
39: + PMD.EOL
40: + "<center><h3>PMD report</h3></center><center><h3>Problems found</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
41: + PMD.EOL
42: + "<th>#</th><th>File</th><th>Line</th><th>Problem</th></tr>"
43: + PMD.EOL + "<tr bgcolor=\"lightgrey\"> " + PMD.EOL
44: + "<td align=\"center\">1</td>" + PMD.EOL
45: + "<td width=\"*%\">n/a</td>" + PMD.EOL
46: + "<td align=\"center\" width=\"5%\">1</td>" + PMD.EOL
47: + "<td width=\"*\">msg</td>" + PMD.EOL + "</tr>"
48: + PMD.EOL + "<tr> " + PMD.EOL
49: + "<td align=\"center\">2</td>" + PMD.EOL
50: + "<td width=\"*%\">n/a</td>" + PMD.EOL
51: + "<td align=\"center\" width=\"5%\">1</td>" + PMD.EOL
52: + "<td width=\"*\">msg</td>" + PMD.EOL + "</tr>"
53: + PMD.EOL + "</table></body></html>";
54: }
55:
56: public String getExpectedError(ProcessingError error) {
57: return "<html><head><title>PMD</title></head><body>"
58: + PMD.EOL
59: + "<center><h3>PMD report</h3></center><center><h3>Problems found</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
60: + PMD.EOL
61: + "<th>#</th><th>File</th><th>Line</th><th>Problem</th></tr>"
62: + PMD.EOL
63: + "</table><hr/><center><h3>Processing errors</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
64: + PMD.EOL + "<th>File</th><th>Problem</th></tr>"
65: + PMD.EOL + "<tr bgcolor=\"lightgrey\"> " + PMD.EOL
66: + "<td>file</td>" + PMD.EOL + "<td>Error</td>"
67: + PMD.EOL + "</tr>" + PMD.EOL
68: + "</table></body></html>";
69: }
70:
71: public static junit.framework.Test suite() {
72: return new junit.framework.JUnit4TestAdapter(
73: HTMLRendererTest.class);
74: }
75: }
|