groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Heintze <>
Subject Wanted: Help understanding Groovy Syntax for DBUnit Example
Date Thu, 02 Jul 2015 22:00:57 GMT
I love this example and it even works!

Can someone help me understand the syntax on lines 29-33? (1) What is dataset? Are we passing
it a lambda? 
OK, so semi-colons are optional. Hmmm... Apparently we have a list of emp constructors. Is
this correct? 
(2) How is it that the "{}" are constructing a list of emps?
Why is there no code like "[ emp empno:7369, ename:'SMITH', job:'CLERK' emp empno:7499, ename:'ALLEN',
job:'SALESMAN'  emp empno:7521, ename:'WARD', job:'SALESMAN'] as List"?
(3) And what about emp? Who defines the class emp and its constructor? Where?
(4) And what is this business with the grape.grab inside the static {}? I've never seen the
keyword static in groovy code before.  Why static? Why not "@Grab" instead of grapes.grab
(inside the static)?

View raw message