大名鼎鼎的java动态脚本语言。已经通过了sun的认证

源代码在线查看: vargstest.groovy

软件大小: 1630 K
上传用户: hjf
关键词: java sun 动态 脚本
下载地址: 免注册下载 普通下载 VIP

相关代码

				class VArgsTest extends GroovyTestCase {								  def primitiveMethod(){0}				  def primitiveMethod(int i) {1}  				  def primitiveMethod(int i, int j) {2}				  def primitiveMethod(int[] is) {10+is.length}				  				  void testPrimitiveMethod() {				    assert primitiveMethod()==0				    assert primitiveMethod(1)==1				    assert primitiveMethod(1,1)==2				    assert primitiveMethod(1,1,1)==13 				    assert primitiveMethod([1,2,2,2] as int[])==14				  }				  				  def objectMethod(){0}				  def objectMethod(Object i) {1}  				  def objectMethod(Object i, Object j) {2}				  def objectMethod(Object[] is) {10+is.length}				  				  void testObjectMethod() {				    assert objectMethod()==0				    assert objectMethod(1)==1				    assert objectMethod(1,1)==2				    assert objectMethod(1,1,1)==13				    assert objectMethod([1,2,2,2] as Object[])==14				  }				  				  def gstringMethod(GString[] gstrings){gstrings.length}				  				  void testGStringVargsMethod() {				    def content = 1				    def gstring ="$content"				    assert gstringMethod() == 0				    assert gstringMethod(gstring) == 1				    assert gstringMethod(gstring,gstring,gstring) == 3				    assert gstringMethod([gstring] as GString[]) == 1				  }				  				  def stringMethod(String[] strings) {strings.length}				  				  void testStringMethod() {				    def content = 1				    def gstring ="$content"				    assert stringMethod() == 0				    assert stringMethod(gstring) == 1				    assert stringMethod(gstring,gstring,gstring) == 3				    assert stringMethod([gstring] as GString[]) == 1				    assert stringMethod() == 0				    assert stringMethod("a") == 1				    assert stringMethod("a","a","a") == 3				    assert stringMethod(["a"] as String[]) == 1				  }				}			

相关资源