-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Add unit tests for Utils #4193
Add unit tests for Utils #4193
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
85f9758
to
6f4b525
Compare
Squashed commits, should now show as one commit. Please note comment intended for @nobodyiam regarding case sensitivity. |
Codecov Report
@@ Coverage Diff @@
## master #4193 +/- ##
=========================================
Coverage 52.60% 52.60%
Complexity 2621 2621
=========================================
Files 484 484
Lines 15192 15192
Branches 1571 1571
=========================================
Hits 7991 7991
Misses 6645 6645
Partials 556 556
Continue to review full report at Codecov.
|
Welcome~ @joshknopp |
apollo-core/src/test/java/com/ctrip/framework/foundation/internals/UtilsTest.java
Show resolved
Hide resolved
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* @author Josh Knopp(https://github.com/joshknopp) |
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 delete the author in javadoc, because your change will be show in git's commit.
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.
No problem - was trying to follow style guide, but I'm indifferent 😄
private String actualOsName; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
actualOsName = System.getProperty("os.name"); | ||
} |
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.
How about delete the setUp method?
Just assign value to actualOsName
once.
private String actualOsName; | |
@BeforeEach | |
void setUp() { | |
actualOsName = System.getProperty("os.name"); | |
} | |
private final String actualOsName = System.getProperty("os.name"); |
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.
Thanks @Anilople for the feedback! Updated in new commit.
0d142d3
to
1b87ff7
Compare
Just realized I have added JUnit5 tests, and everything else appears to be JUnit4 🤦♂️ Is there appetite for 5, or should I reset and try again? |
apollo-core/src/test/java/com/ctrip/framework/foundation/internals/UtilsTest.java
Outdated
Show resolved
Hide resolved
apollo-core/src/test/java/com/ctrip/framework/foundation/internals/UtilsTest.java
Outdated
Show resolved
Hide resolved
apollo-core/src/test/java/com/ctrip/framework/foundation/internals/UtilsTest.java
Outdated
Show resolved
Hide resolved
It may keep some sort of consistency if we write the unit tests in JUnit 4 styles but generally, I think it's all right. What do you think @Anilople ? |
Looks like Codecov is not picking up JUnit 5 so I'll try rewriting with 4. |
1b87ff7
to
b7d4619
Compare
@nobodyiam |
@nobodyiam do we consider use apache |
A reliable middleware need to reduce dependencies as it can. So if we can implement the function via a few code, it's better implement without third dependencies. Just a bit of my thoughts. |
I think it's all right too in this pr. An issue #4195 was opend to disscus upgrade to junit 5 or not. |
@Anilople |
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.
LGTM
@shoothzj |
Agreed. I will start another issue discuss this |
What's the purpose of this PR
Increase test coverage on one class to help push toward 80% coverage goal.
Which issue(s) this PR fixes:
Fixes #3874
Brief changelog
Add 100% test coverage for a single Utils class
Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean test
to make sure this pull request doesn't break anything.CHANGES
log.