longparameterlistruletest.java

来自「检查Java程序漏洞」· Java 代码 · 共 38 行

JAVA
38
字号
/** * BSD-style license; for more info see http://pmd.sourceforge.net/license.html*/package test.net.sourceforge.pmd.rules.design;import net.sourceforge.pmd.PMD;import net.sourceforge.pmd.rules.design.LongParameterListRule;import test.net.sourceforge.pmd.testframework.RuleTst;public class LongParameterListRuleTest extends RuleTst {    private static final String TEST1 =    "public class LongParameterList0 {" + PMD.EOL +    "    public void foo() {}" + PMD.EOL +    "}";    private static final String TEST2 =    "public class LongParameterList1 {" + PMD.EOL +    "    public void foo(int p01, int p02, int p03, int p04, int p05," + PMD.EOL +    "                   int p06, int p07, int p08, int p09, int p10 ) { }" + PMD.EOL +    "    public void bar(int p01, int p02, int p03, int p04, int p05 ) { }" + PMD.EOL +    "}";    public LongParameterListRule getIUT() {        LongParameterListRule IUT = new LongParameterListRule();        IUT.addProperty("minimum", "9");        return IUT;    }    public void testShortMethod() throws Throwable {        runTestFromString(TEST1, 0, getIUT());    }    public void testOneLongMethod() throws Throwable {        runTestFromString(TEST2, 1, getIUT());    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?