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

📄 evaltest.java

📁 大名鼎鼎的java动态脚本语言。已经通过了sun的认证
💻 JAVA
字号:
package groovy.util;import junit.framework.TestCase;import org.codehaus.groovy.control.CompilationFailedException;/** * Testing the simple Groovy integration with Eval. * * @author Dierk Koenig */public class EvalTest extends TestCase {    public void testMeSimple() throws CompilationFailedException {        Object result = Eval.me("10");        assertEquals("10", result.toString());    }    public void testMeWithSymbolAndObject() throws CompilationFailedException {        Object result = Eval.me("x", new Integer(10), "x");        assertEquals("10", result.toString());    }    public void testX() throws CompilationFailedException {        Object result = Eval.x(new Integer(10), "x");        assertEquals("10", result.toString());    }    public void testXY() throws CompilationFailedException {        Integer ten = new Integer(10);        Object result = Eval.xy(ten,ten, "x+y");        assertEquals("20", result.toString());    }     public void testXYZ() throws CompilationFailedException {        Integer ten = new Integer(10);        Object result = Eval.xyz(ten,ten,ten, "x+y+z");        assertEquals("30", result.toString());    }}

⌨️ 快捷键说明

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