View Javadoc
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 import net.sourceforge.pmd.ant.PMDTask; 9 import org.apache.tools.ant.BuildException; 10 11 public class PMDTaskTest extends TestCase { 12 13 public void testNoFormattersValidation() { 14 PMDTask task = new PMDTask(); 15 try { 16 task.execute(); 17 throw new RuntimeException("Should have thrown a BuildException - no Formatters"); 18 } catch (BuildException be) { 19 // cool 20 } 21 } 22 23 public void testFormatterWithNoToFileAttribute() { 24 PMDTask task = new PMDTask(); 25 task.addFormatter(new Formatter()); 26 try { 27 task.execute(); 28 throw new RuntimeException("Should have thrown a BuildException - a Formatter was missing a toFile attribute"); 29 } catch (BuildException be) { 30 // cool 31 } 32 } 33 34 public void testNoRuleSets() { 35 PMDTask task = new PMDTask(); 36 task.setPrintToConsole(true); 37 try { 38 task.execute(); 39 throw new RuntimeException("Should have thrown a BuildException - no rulesets"); 40 } catch (BuildException be) { 41 // cool 42 } 43 } 44 45 }

This page was automatically generated by Maven