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

📄 accessnodetest.java

📁 检查Java程序漏洞
💻 JAVA
字号:
/** * BSD-style license; for more info see http://pmd.sourceforge.net/license.html*/package test.net.sourceforge.pmd.ast;import junit.framework.TestCase;import net.sourceforge.pmd.ast.AccessNode;public class AccessNodeTest extends TestCase {    public void testStatic() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not static.", !node.isStatic());        node.setStatic();        assertTrue("Node set to static, not static.", node.isStatic());    }    public void testPublic() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not public.", !node.isPublic());        node.setPublic();        assertTrue("Node set to public, not public.", node.isPublic());    }    public void testProtected() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not protected.", !node.isProtected());        node.setProtected();        assertTrue("Node set to protected, not protected.", node.isProtected());    }    public void testPrivate() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not private.", !node.isPrivate());        node.setPrivate();        assertTrue("Node set to private, not private.", node.isPrivate());    }    public void testFinal() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not final.", !node.isFinal());        node.setFinal();        assertTrue("Node set to final, not final.", node.isFinal());    }    public void testSynchronized() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not synchronized.", !node.isSynchronized());        node.setSynchronized();        assertTrue("Node set to synchronized, not synchronized.", node.isSynchronized());    }    public void testVolatile() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not volatile.", !node.isVolatile());        node.setVolatile();        assertTrue("Node set to volatile, not volatile.", node.isVolatile());    }    public void testTransient() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not transient.", !node.isTransient());        node.setTransient();        assertTrue("Node set to transient, not transient.", node.isTransient());    }    public void testNative() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not native.", !node.isNative());        node.setNative();        assertTrue("Node set to native, not native.", node.isNative());    }    public void testInterface() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not interface.", !node.isInterface());        node.setInterface();        assertTrue("Node set to interface, not interface.", node.isInterface());    }    public void testAbstract() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not abstract.", !node.isAbstract());        node.setAbstract();        assertTrue("Node set to abstract, not abstract.", node.isAbstract());    }    public void testStrict() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not strict.", !node.isStrict());        node.setStrict();        assertTrue("Node set to strict, not strict.", node.isStrict());    }    public void testSuper() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to not super.", !node.isSuper());        node.setSuper();        assertTrue("Node set to super, not super.", node.isSuper());    }    public void testPackagePrivate() {        AccessNode node = new AccessNode(1);        assertTrue("Node should default to package private.", node.isPackagePrivate());        node.setPrivate();        assertTrue("Node set to private, still package private.", !node.isPackagePrivate());        node = new AccessNode(1);        node.setPublic();        assertTrue("Node set to public, still package private.", !node.isPackagePrivate());        node = new AccessNode(1);        node.setProtected();        assertTrue("Node set to protected, still package private.", !node.isPackagePrivate());    }}

⌨️ 快捷键说明

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