View Javadoc

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