Sunday, April 11, 2010

GivWenZen Beta 10 - Vararg Support for Step Parameters

I have finished packaging the new GivWenZen 1.0 beta 10 release. Someday I may not call it a beta but not sure I am ready for that.

The most interesting new feature was the ability to allow varargs for step parameters. A specification can now have something like the following:

given: the numbers 3, 6,12, 67

The step method to handle this could look like this:

@DomainStep("the numbers (.*)"
public setTheNumbers(int... numbers) {
// implementation here
}

This will work for all native types, String and any type that can use the normal PropertyEditor conversion of GivWenZen.

While doing this I realized that there needed to be a convention in place for automatically loading a step parameter conversion type, an implementation of MethodParameterParser, when starting a GivWenZen instance. That is now possible by placing a class that implements MethodParameterParser in the bdd.parse package. As with other custom types they are used before the default converters are used.

A few other small issues were fixed and the full list can be found here.