The IDE world just started to look a little greener for Griffon programmers. Today’s latest early access version of JetBrains IntelliJ version Maia has initial support for Griffon!
It appeared on the JetBrains blogroll a couple of weeks ago, and indeed may have showed up in an earlier release, but today was the first time I saw it in action. I couldn’t find anything about this new feature mentioned explicitly in the release notes but sure enough, it’s there. Given the similar project structure between Grails and Griffon, and the first class Grails support already available in IntelliJ, it’s really not too hard to see how this platform is in an ideal position to expand Griffon support. Beyond that the general Groovy support seems to get better in every release. The EAP is free to try for any holder of an IntelliJ 8.x license and seems to be pretty stable despite the disclaimers – I highly recommend taking it for a spin, especially if you’re already using this IDE. You get properly configured source directories and dependency paths, access to Griffon’s command line scripts, and even that awesome new Griffon icon shown to mark out the project. What more could you ask for?
JetBrains was beaten to the punch by a NetBeans plugin for Griffon that was released in its initial version before this year’s Java One conference. I’m not a NetBeans user myself, but I am a frequent reader of Geertjan Wielenga’s blog – he’s published some great Groovy examples. Even the Eclipse community has finally gotten around to putting out some real Groovy support, largely due to SpringSource‘s commitment.
Hopefully their recent acquisition by VMWare won’t distract them from developing it too much π
Regardless of which development environment you feel most comfortable with, there’s no questioning this is a great time to be a Groovy/Grails/Griffon developer so enjoy!
Tags:
eap,
Eclipse,
Grails,
Griffon,
Groovy,
Integrated development environment,
IntelliJ IDEA,
Java,
NetBeans,
Programming,
SpringSource
TestNG is a great tool for testing in Java, and it works even better with a little Groovy thrown in. Just lately I’ve had a lot of success using the DataProvider pattern.
A DataProvider method in TestNG can return either a two dimensional Object array or an Iterator over each of the test parameters. A consumer of that method will be triggered once time for each set of parameters from the provider. Parameters are injected into the consumer method at execution time.
This greatly eases testing various expectations that run through essentially the same path of execution.
Here’s the simple method under test, courtesy of this example on Groovy Almanac
[groovy language=”true”]
/**
* Use the Groovy added List.inject() method to sum a list of numbers.
*/
def sum(list)
{
def sum = list.inject(0) { sum, item -> sum + item }
}
[/groovy]
And here’s the corresponding DataProvider test harness. The test is injected with a List of numbers to sum and the associated total expected for each case.
[groovy language=”true”]
@DataProvider (name = "test1")
public Object[][] createListInjectSumData() {
def array = new Object[3][]
array[0] = [[1, 2, 3], 6] as Object[]
array[1] = [[2, 4, 6], 12] as Object[]
array[2] = [[3, 6, 9], 18] as Object[]
return array
}
@Test (dataProvider = "test1")
void testListInjectSummation(list, expectedSum) {
Assert.assertEquals(new ListInjectExample().sum(list), expectedSum)
}
[/groovy]
I’ve put the maven project I used to demo this up on github here. Mostly just because I’m having a great time using Git lately.
π