Add ParameterType.fromEnum(Class enumClass) - #423
Merged
Conversation
mpkorstanje
self-requested a review
July 15, 2018 15:39
mpkorstanje
reviewed
Jul 27, 2018
| @Test | ||
| public void converts_to_enum() { | ||
| ParameterTypeRegistry registry = new ParameterTypeRegistry(Locale.ENGLISH); | ||
| registry.defineParameterType(ParameterType.fromEnum(Mood.class)); |
Member
There was a problem hiding this comment.
Is this a parameter type fromEnum or forEnum?
When using a static import I think registry.defineParameterType(forEnum(Mood.class)); reads a bit better.
Member
There was a problem hiding this comment.
OTOH: fromEnum is kinda the well known standard.
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Simplify creation of
ParameterTypefrom an enum classDetails
The enum constants' names are used to build a regexp for the match (
red|green|blue), and the name is the simplified name of the enum class (Color).Motivation and Context
See cucumber/cucumber-jvm#1393 (comment)
Types of changes
Checklist: