    1   /***
    2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
    3    */
    4   package test.net.sourceforge.pmd.ant;
    5
    6   import junit.framework.TestCase;
    7   import net.sourceforge.pmd.ant.Formatter;
    8
    9   import java.io.File;
    10
    11  public class FormatterTest extends TestCase {
    12
    13      public void testType() {
    14  /*
    15          Formatter f = new Formatter();
    16          f.setType("xml");
    17          assertTrue(f.getRenderer() instanceof XMLRenderer);
    18          f.setType("text");
    19          assertTrue(f.getRenderer() instanceof TextRenderer);
    20          f.setType("csv");
    21          assertTrue(f.getRenderer() instanceof CSVRenderer);
    22          f.setType("html");
    23          assertTrue(f.getRenderer() instanceof HTMLRenderer);
    24          try {
    25              f.setType("FAIL");
    26              f.getRenderer();
    27              throw new RuntimeException("Should have failed!");
    28          } catch (BuildException be) {
    29              // cool
    30          }
    31  */
    32      }
    33
    34      public void testNull() {
    35          Formatter f = new Formatter();
    36          assertTrue("Formatter toFile should start off null!", f.isNoOutputSupplied());
    37          f.setToFile(new File("foo"));
    38          assertFalse("Formatter toFile should not be null!", f.isNoOutputSupplied());
    39      }
    40  }