pmdtasktest.java
来自「检查Java程序漏洞」· Java 代码 · 共 46 行
JAVA
46 行
/** * BSD-style license; for more info see http://pmd.sourceforge.net/license.html*/package test.net.sourceforge.pmd.ant;import junit.framework.TestCase;import net.sourceforge.pmd.ant.Formatter;import net.sourceforge.pmd.ant.PMDTask;import org.apache.tools.ant.BuildException;public class PMDTaskTest extends TestCase { public void testNoFormattersValidation() { PMDTask task = new PMDTask(); try { task.execute(); throw new RuntimeException("Should have thrown a BuildException - no Formatters"); } catch (BuildException be) { // cool } } public void testFormatterWithNoToFileAttribute() { PMDTask task = new PMDTask(); task.addFormatter(new Formatter()); try { task.execute(); throw new RuntimeException("Should have thrown a BuildException - a Formatter was missing a toFile attribute"); } catch (BuildException be) { // cool } } public void testNoRuleSets() { PMDTask task = new PMDTask(); task.setPrintToConsole(true); try { task.execute(); throw new RuntimeException("Should have thrown a BuildException - no rulesets"); } catch (BuildException be) { // cool } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?