-
Notifications
You must be signed in to change notification settings - Fork 55
feat: Add dedicated annotations for boolean, String, int and double flags in Junit5 extension #1478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Add dedicated annotations for boolean, String, int and double flags in Junit5 extension #1478
Conversation
@Test | ||
@BooleanFlag(name = FLAG, value = true) | ||
@BooleanFlag(name = FLAG, value = false) | ||
void duplicatedTypedFlagsSimple() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use more descriptive names for your tests, maybe something like duplicateFlagKeyOverridesPreviousDeclaration
@ssharaev you will need to force push a commit that is signed off, otherwise the DCO check will not succeed |
…lags in Junit5 extension Signed-off-by: Sviatoslav Sharaev <sviatoslav.sharaev@gmail.com>
d53dc31
to
6777d82
Compare
@@ -29,6 +37,13 @@ void existingSimpleFlagIsRetrieved() { | |||
assertThat(client.getDoubleValue(FLAG, FALLBACK)).isEqualTo(FLAG_VALUE); | |||
} | |||
|
|||
@Test | |||
@DoubleFlag(name = FLAG, value = 1.d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DoubleFlag(name = FLAG, value = 1.d) | |
@DoubleFlag(name = FLAG, value = FLAG_VALUE) |
also for the other tests
if (domainFlagNames.contains(flagName)) { | ||
throw new IllegalArgumentException("Flag with name " + flagName + " already exists. " | ||
+ "There shouldn't be @Flag and @" + value.getClass().getSimpleName() + "Flag with the same name!"); | ||
} | ||
|
||
if (domainFlags.containsKey(flagName)) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of these checks is redundant. I think we could even remove the domainFlagNames
set entirely, as it contains the same information as the domainFlags
map.
This PR
BooleanFlag
,StringFlag
,IntegerFlag
, andDoubleFlag
for more specific and type-safe flag definitions in JUnit testsRelated Issues
Fixes #923
Notes
Not sure about tests, feedback on the test coverage is very welcome!