test(apollo-core): PropertiesUtilTest#4113
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
Codecov Report
@@ Coverage Diff @@
## master #4113 +/- ##
============================================
+ Coverage 52.49% 52.55% +0.05%
- Complexity 2614 2616 +2
============================================
Files 484 484
Lines 15206 15206
Branches 1572 1572
============================================
+ Hits 7983 7992 +9
+ Misses 6671 6660 -11
- Partials 552 554 +2
Continue to review full report at Codecov.
|
Anilople
left a comment
There was a problem hiding this comment.
Thank you for your time to participate in open source contributions.
Welcome!
|
|
||
| @Test | ||
| public void TestProperties() throws IOException { | ||
| assertTrue("".equals(PropertiesUtil.toString(new Properties()))); |
There was a problem hiding this comment.
Use assertEqual or assertEquals instead of assertTrue
|
|
||
| Properties properties = new Properties(); | ||
| properties.put("a","aaa"); | ||
| assertTrue("a=aaa\r\n".equals(PropertiesUtil.toString(properties)) |
There was a problem hiding this comment.
User System.lineSeperator instead of hard code \r\n \n
|
|
||
| @Test | ||
| public void TestFilterComment(){ | ||
| StringBuffer sb=new StringBuffer("#aaaaa\nbbb"); |
There was a problem hiding this comment.
String.join(System.lineSepeartor, "#aaaaa“, "bbb"); ?
| } | ||
|
|
||
| @Test | ||
| public void TestFilterComment(){ |
There was a problem hiding this comment.
| public void TestFilterComment(){ | |
| public void testFilterPropertiesComment(){ |
Keep the method name's convention of test case.
| @Test | ||
| public void TestFilterComment(){ | ||
| StringBuffer sb=new StringBuffer("#aaaaa\nbbb"); | ||
| PropertiesUtil.filterPropertiesComment(sb); |
There was a problem hiding this comment.
You can add more test case to cover all conditional branchs
…s/PropertiesUtilTest.java Co-authored-by: wxq <Anilople@outlook.com>
| import java.util.Properties; | ||
|
|
||
| /** | ||
| * @author Wu Mingkan(Dalian University of Technology) |
There was a problem hiding this comment.
Should delete author in community project.
What's the purpose of this PR
I write a test file for \apollo-core\src\main\java\com\ctrip\framework\apollo\core\utils\PropertiesUtils.java
Which issue(s) this PR fixes:
Fixes #3874
Brief changelog
write two test method for the two function in PropertiesUtils.java seperately.
Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean testto make sure this pull request doesn't break anything.CHANGESlog.