How can I make the annotation @ParemeterType use a list?
Hello!
As I am continuing my Cucumber 7.0.0 uplift journey I have stumbled upon some issues. The old way on how to handle parameter types is deprecated so now the annotations @ParameterType and @DataTableType are used instead. My problem is that we are using many enums (I cannot show you how the real code looks like since I signed an NDA) and before they were looped through in an Array stream. To make it work now I have to hardcode the enums in the value field like this:
@ParameterType(name = "animal_type", value "(CAT|HORSE|DOG|DONKEY|PIG)")
public Animal defineAnimalType(final String animalType) {
return Animal.fromString(animalType);
}
And this is not an optimal solution because if the enums needs to be changed in the future people need to look up the hardcoded strings and change there as well. I read about something called @DefaultParameterTransformer and I wonder if that can be an option.
Does anyone have a suggestion or solution for this problem? I would really appreciate it!
Best Regards
Lisa Marie