Skip to content

Feature: automatically convert data tables to lists of enums just as is done with classes #346

Closed
newmanne opened this Issue Jun 14, 2012 · 3 comments

2 participants

@newmanne

Let's say I have a test that reads:

Then I see these colors:
  | color |
  | RED |
  | YELLOW |
  | BLUE |

and I have an enum that reads

public static enum Color {
        RED, YELLOW, BLUE
}

then in the step definition I want to do something like:

@Then("^I see the following colors$")
public void I_see_the_following_colors(List<Color> colors) {
}

Currently I get:

cucumber.runtime.CucumberException: Can't assign null value to one of the primitive fields in com.Color ColorStepDefinitions$color. Please use boxed types.

It would be great if the behavior would mimic what is being done for classes, as in the shopping cart example in hello world and just do the conversion for me.

@aslakhellesoy
Cucumber member

Fixing this might be related to #320.

@aslakhellesoy
Cucumber member

In order for this to work we'd probably have to skip the header:

Then I see these colors:
  | RED    |
  | YELLOW |
  | BLUE   |
@aslakhellesoy
Cucumber member

This is fixed in 1.0.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.