// 1900..1999 包含边界// 2000..<2100 不包含边界twentiethCentury = 1900..1999reverseTen = 10..1println(twentiethCentury)println(reverseTen)println(twentiethCent...
分类:
其他好文 时间:
2015-10-22 23:56:07
阅读次数:
300
numbers = [11, 12, 13, 14]println(numbers[0])println(numbers[3])println(numbers[-1])//最左边的元素println(numbers[-3])//最左边的第3元素println(numbers[0..2])//第0, ...
分类:
其他好文 时间:
2015-10-22 00:07:35
阅读次数:
144
迭代:defnames=["sky","lily","tom"]
names.forEach{
printlnit.toUpperCase()
}
map=[‘a‘:1,‘b‘:2]
map.each{key,value->
map[key]=value*2
}
assertmap==[‘a‘:2,‘b‘:4]
//结果
SKY
LILY
TOM
true回调defhouston(Closuredoit){
(10..1).each{count->
doit(..
分类:
其他好文 时间:
2015-10-20 19:41:02
阅读次数:
271
最近工作中,处理最多的就是xml和json类型response,在SoapUI中request里面直接添加assertion处理json response的话,可以采用以下方式:import groovy.json.JsonSlurperdef response= testRunner.testCa...
分类:
Web程序 时间:
2015-10-14 00:21:26
阅读次数:
601
承接上一篇,配置好环境后,开始正式学习语法。我假设看此文的同学至少会一定的JAVA语法,因此一些太过基础的就不记录了,基本上,大家看看示例就明白了。 Groovy的卖点之一,就是全兼容JAVA的语法,因此你完全可以从一个JAVA文件中把源代码复制到一个Groovy文件中而不必改写任何一个字直接运行,...
分类:
其他好文 时间:
2015-10-10 00:21:43
阅读次数:
338
try, catch and finally in db connectionForming groovy connection string and obtaining Connection ObjectFiring Select Query and obtaining resultsForeac...
分类:
数据库 时间:
2015-10-08 16:11:34
阅读次数:
229
def x = new String[3]x[0] = "A"x[1] = "B"x[2] = "C"log.info"XXXXXX 1"try{ x[3] = "D"// def z=9/0}catch(Exception e){ log.info "Some error "+e.getMessa...
分类:
其他好文 时间:
2015-10-06 22:11:38
阅读次数:
194
Employee.log=logEmployee e1 = new Employee()log.info e1.add(1,2,3,4)// optional parameters in groovylog.info e1.add(2,3)log.info e1.add(2,3,10)class E...
分类:
其他好文 时间:
2015-10-06 20:51:22
阅读次数:
207
Bank.log = logBank b1 = new Bank()b1.name = "BOA"b1.minbalance = 100b1.city="London"Bank b2 = new Bank()b2.name = "HSBC"b2.minbalance = 100b2.city="LA...
分类:
其他好文 时间:
2015-10-06 20:43:12
阅读次数:
139
Planet.log = loglog.info "starting"// we use class to create objects of a classPlanet p1 = new Planet()Planet p2 = new Planet()Planet p3 = new Planet....
分类:
其他好文 时间:
2015-10-06 18:05:30
阅读次数:
136