cucumber-attic / cuke4duke

Cucumber support for the JVM: Java, Scala, Groovy, Clojure, Ioke, Javascript, Spring, Guice, PicoContainer, WebDriver, Ant and Maven
http://wiki.github.com/aslakhellesoy/cuke4duke
MIT License
256 stars 72 forks source link

Fixed optional capture groups in step definitions #124

Closed bcluca closed 10 years ago

bcluca commented 13 years ago

Hi,

I have resolved an issue with cuke4duke not handling optional capture groups correctly in step definitions.

You can reproduce this bug using the following step definition

@Then("^I am( not)? handling optional capture groups correctly$")
public void handlingOptionalCaptureGroups(String not) {
    ...
}

along with the feature step below

Then I am handling optional capture groups correctly

Basically we get a String index out of range exception when the optional parameter is not provided (matching with an empty string).

This patch makes the String parameter available and empty in this case, as expected.

Unit tests are provided as well and the patch comes in a topic branch, to easily accommodate any further changes before merging.

Hope to see this pulled soon :D

Thanks, Luca Bernardo Ciddio

bcluca commented 10 years ago

Closed since this project is defunct.