to the JVM Compiled, not interpreted Interacts transparently with Java If you don’t know the Groovy way, use Java Scripts as well as classes Open source project
placement : placements) { if (placement.isBooked()) { bookedPlacements.add(placement); } } Collections.sort(bookedPlacements, new Comparator<Placement>() { public int compare(Placement p1, Placement p2) { int r = p1.getwPrice().compareTo(p2.getwPrice()); if (r == 0) { r = p1.getCreationDate() .compareTo(p2.getCreationDate()); } return r; } });
turn(left).then(right) take 2.pills of chloroquinine after 6.hours // equivalent to: take(2.pills).of(chloroquinine).after(6.hours) paint wall with red, green and yellow // equivalent to: paint(wall).with(red, green).and(yellow) // with named parameters too check that: margarita tastes good // equivalent to: check(that:margarita).tastes(good) // with closures as parameters given { } when { } then { } // equivalent to: given({}).when({}).then({})
queue = new Queue() } it "should dequeue gives item just enqueued", { queue.enqueue(2) queue.dequeue().shouldBe(2) } it "should throw an exception when null is enqueued", { ensureThrows(RuntimeException){ queue.enqueue(null) } }
<ru>Тестовый визард</ru> </title> <info> <ua>Цей візард призначений для тестування</ua> <ru>Этот визард предназначен для тестирования</ru> </info> <steps> <step id="Step1" previousButton="false" nextButton="true" cancelButton="true" finishButton="false"> <title> <ua>Перший крок</ua> <ru>Первый шаг</ru> </title> <info> <ua> На першому кроці нам нічого особливого не треба робити. Він просто призначений для перевірки різних TextBox. </ua> <ru> На первом шаге нам ничего особенного делать не надо. Он просто предназначен для проверки разных TextBox. </ru> </info>
"Тестовий візард", ru: "Тестовый визард" info ua: "Цей візард призначений для тестування", ru: "Этот визард предназначен для тестирования" steps "Step1": { previousButton false nextButton true cancelButton true finishButton false title ua: "Перший крок", ru: "Первый шаг" info ua: ''' На першому кроці нам нічого особливого не треба робити. Він просто призначений для перевірки різних TextBox.''', ru: ''' На первом шаге нам ничего особенного делать не надо. Он просто предназначен для проверки разных TextBox.'''
queue = new Queue() } it "should dequeue gives item just enqueued", { queue.enqueue(2) queue.dequeue().shouldBe(2) } it "should throw an exception when null is enqueued", { ensureThrows(RuntimeException){ queue.enqueue(null) } }
queue = new Queue() } it "should dequeue gives item just enqueued", { queue.enqueue(2) queue.dequeue().shouldBe(2) } it "should throw an exception when null is enqueued", { ensureThrows(RuntimeException){ queue.enqueue(null) } }
when "null is pushed", { pushnull = { stack.push(null) } } then "an exception should be thrown", { ensureThrows(RuntimeException){ pushnull() } } and "then the stack should still be empty", { stack.empty.shouldBe true }
"Тестовий візард", ru: "Тестовый визард" info ua: "Цей візард призначений для тестування", ru: "Этот визард предназначен для тестирования" steps "Step1": { previousButton false nextButton true cancelButton true finishButton false title ua: "Перший крок", ru: "Первый шаг" info ua: ''' На першому кроці нам нічого особливого не треба робити. Він просто призначений для перевірки різних TextBox.''', ru: ''' На первом шаге нам ничего особенного делать не надо. Он просто предназначен для проверки разных TextBox.'''
queue = new Queue() } it "should dequeue gives item just enqueued", { queue.enqueue(2) queue.dequeue().shouldBe(2) } it "should throw an exception when null is enqueued", { ensureThrows(RuntimeException){ queue.enqueue(null) } }
queue = new Queue() } it "should dequeue gives item just enqueued", { queue.enqueue(2) queue.dequeue().shouldBe(2) } it "should throw an exception when null is enqueued", { ensureThrows(RuntimeException){ queue.enqueue(null) } }