⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pmdtasktest.java

📁 检查Java程序漏洞
💻 JAVA
字号:
/** * 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -