View Javadoc

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