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

Test coverage #4280

Merged
merged 12 commits into from
Mar 28, 2022
Merged

Test coverage #4280

merged 12 commits into from
Mar 28, 2022

Conversation

ayush0407
Copy link
Contributor

What's the purpose of this PR

This PR increases the JUnit coverage and also test's out the classes involved.

XXXXX

Which issue(s) this PR fixes:

Fixes #3874

Brief changelog

XXXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Update the CHANGES log.

@codecov-commenter
Copy link

codecov-commenter commented Mar 27, 2022

Codecov Report

Merging #4280 (5042a88) into master (63e959f) will increase coverage by 0.56%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master    #4280      +/-   ##
============================================
+ Coverage     52.56%   53.12%   +0.56%     
- Complexity     2641     2666      +25     
============================================
  Files           488      488              
  Lines         15253    15253              
  Branches       1577     1577              
============================================
+ Hits           8017     8103      +86     
+ Misses         6685     6593      -92     
- Partials        551      557       +6     
Impacted Files Coverage Δ
.../apollo/internals/RemoteConfigLongPollService.java 77.10% <0.00%> (-1.21%) ⬇️
...ervice/service/ReleaseMessageServiceWithCache.java 85.88% <0.00%> (-1.18%) ⬇️
...ctrip/framework/apollo/common/utils/BeanUtils.java 85.29% <0.00%> (+85.29%) ⬆️
...rk/apollo/common/exception/BeanUtilsException.java 100.00% <0.00%> (+100.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63e959f...5042a88. Read the comment docs.

public void testMapByKeyEmptyList() {
List<Integer> someList = new ArrayList<>();
assertNotNull(BeanUtils.mapByKey(null, someList));

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

List<KeyClass> someList = new ArrayList<>();
someList.add(new KeyClass());
assertNotNull(BeanUtils.mapByKey("keys", someList));

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

List<KeyClass> someList = new ArrayList<>();
someList.add(new KeyClass());
assertNotNull(BeanUtils.mapByKey("wrongKey", someList));

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

public void testAggByKeyToListEmpty() {
List<KeyClass> someList = new ArrayList<>();
assertNotNull(BeanUtils.aggByKeyToList("keys", someList));

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

List<KeyClass> someList = new ArrayList<>();
someList.add(new KeyClass());
assertNotNull(BeanUtils.aggByKeyToList("keys", someList));

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

public void testToPropertySetEmpty() {
List<KeyClass> someList = new ArrayList<>();
assertNotNull(BeanUtils.toPropertySet("keys", someList));

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

List<KeyClass> someList = new ArrayList<>();
someList.add(new KeyClass());
assertNotNull(BeanUtils.toPropertySet("keys", someList));

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

List<KeyClass> someList = new ArrayList<>();
someList.add(new KeyClass());
assertNotNull(BeanUtils.toPropertySet("wrongKey", someList));

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

public void testGetAndsetProperty() {
BeanUtils.setProperty(new KeyClass(), "keys", "value");
assertNull(BeanUtils.getProperty(new KeyClass(), "keys"));

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

Comment on lines 143 to 145



Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

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

LGTM

@nobodyiam nobodyiam merged commit f6ce7f5 into apolloconfig:master Mar 28, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2022
@nobodyiam nobodyiam added this to the 2.0.0 milestone Apr 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test: improve coverage
3 participants