Test forward method of Controller

This blogpost titled “Test forward method of Controller” explains the technique that can be used to test forward method of controller. Recently, I was writing test cases in grails to test an action : def performAction() { forward(controller:...

Dynamicity of Groovy

Groovy is one of the famous JVM based language which come up with a lot of groovier functionality in it. Groovy provides a great feature : Metaprogramming at run time and this is what i am calling Dynamicity of Groovy. Do not confuse with Dynamically Typed languages...

Harnessing the power of groovy

This blog post “Harnessing the power of groovy” demonstrates the power of groovy language. In java, what could take 10-15 lines, in groovy we can achieve it using 1-line code. Multiply Each Number by 2 (1..10).collect{it * 2} Adding numbers in a list...

Xml validation against xsd

Validates the XML document against the specified XSD document. XSD document are “XML Schema” that describe the structure of a XML document. The validator identify given XML file must be parsable using a DOM/SAX parser, and only then it will validate your...

MultiMethod: Method dispatching in Groovy and Java

We know polymorphism is a fundamental concept in Java and groovy supports this concept as well but in enhanced way, do you think how? let us take an example: class MultiMethodDemo{ int multiMethod(String arg){ return 1 } int multiMethod(Object arg){ return 2 } public...