GoG

Spock for Groovy – I

The DSL capability of Groovy is a well known fact. When it comes to writing test cases for Groovy/Grails applications the API has always been not a very pleasant one. People talk about the unit tests being the best documentation […]

Groovy-Closure with variable number of arguments

Last week somebody tossed up a question of using variable number of arguments with Groovy. We’re implementing a method called ‘add‘ in the String class using meta-programming. The add method should just append any number of string arguments passed to […]

Groovy/Java ArrayList code comparison

Given below is the code to create a simple ArrayList in Java and it’s equivalent in Groovy. //Code in Java ArrayList<String> countries = new ArrayList<String>(); countries.add("India"); countries.add("France"); countries.add("Spain"); System.out.println(countries.getClass().getName());//Prints java.util.ArrayList for(int i=0;i<countries.size();i++){ System.out.println(countries.get(i)); } The Groovy equivalent of the same. […]

Interesting read about Spring Framework 4.0

Groovy/Grails has really spoiled developers like us. Working in Java with core Spring libraries seems to be a bitter pill these days. Though we can configure Groovy classes as beans in Spring it only looks like a plugin in the […]

Groovy 2.0 and static type checking

A common sentiment echoed by developers of Groovy is that Groovy being a dynamically-typed language, makes them catch the syntax errors on type-safety only during runtime. The answer to that is Test Driven Development. Unfortunately a majority do not use […]