Skip to content
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

chore: fix jacoco coverage minimum, throw in memory provider #561

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

toddbaert
Copy link
Member

@toddbaert toddbaert commented Aug 15, 2023

Small changes to satisfy jacoco coverage failing in main (bring above 80%).

Also throwing in the new in-memory provider instead of returning error resolutions.

cc @liran2000 I missed these small things on your PR. I hope they make sense.

@toddbaert toddbaert requested a review from a team as a code owner August 15, 2023 20:04
if (ProviderState.ERROR.equals(state)) {
errorCode = ErrorCode.GENERAL;
if (ProviderState.NOT_READY.equals(state)) {
throw new ProviderNotReadyError("provider not yet initialized");
Copy link
Member Author

@toddbaert toddbaert Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liran2000 throwing like this ends in the same result, but it's a bit easier to trace, and also simpler to write. This is how we generally recommend it's done. There is a small performance cost in serialization of the exception, but I think it's worth it.

Comment on lines +89 to +101
@Test
void notFound() {
assertThrows(FlagNotFoundError.class, () -> {
provider.getBooleanEvaluation("not-found-flag", false, new ImmutableContext());
});
}

@Test
void typeMismatch() {
assertThrows(TypeMismatchError.class, () -> {
provider.getBooleanEvaluation("string-flag", false, new ImmutableContext());
});
}
Copy link
Member Author

@toddbaert toddbaert Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These bring coverage of the new package up to 80%+ to fix the failure in main.

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #561 (8f4d50a) into main (6c52ee4) will decrease coverage by 0.63%.
Report is 2 commits behind head on main.
The diff coverage is 88.31%.

@@             Coverage Diff              @@
##               main     #561      +/-   ##
============================================
- Coverage     95.11%   94.49%   -0.63%     
- Complexity      329      357      +28     
============================================
  Files            31       32       +1     
  Lines           758      835      +77     
  Branches         37       50      +13     
============================================
+ Hits            721      789      +68     
- Misses           20       26       +6     
- Partials         17       20       +3     
Flag Coverage Δ
unittests 94.49% <88.31%> (-0.63%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/main/java/dev/openfeature/sdk/Value.java 90.09% <82.60%> (-1.96%) ⬇️
...feature/sdk/providers/memory/InMemoryProvider.java 90.00% <90.00%> (ø)
...ava/dev/openfeature/sdk/FlagEvaluationDetails.java 100.00% <100.00%> (ø)
src/main/java/dev/openfeature/sdk/Structure.java 88.37% <100.00%> (+0.87%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@toddbaert toddbaert changed the title chore: fix codecov, throw in memory provider chore: fix jacoco coverage minimum, throw in memory provider Aug 15, 2023
@sonarcloud
Copy link

sonarcloud bot commented Aug 15, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@toddbaert toddbaert merged commit 1f28921 into main Aug 16, 2023
9 of 11 checks passed
@toddbaert toddbaert deleted the chore/fix-codecov branch August 16, 2023 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants