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(apollo-client): use assertEquals instead of assertThat #3667

Merged
merged 1 commit into from
May 9, 2021

Conversation

Anilople
Copy link
Contributor

@Anilople Anilople commented May 8, 2021

What's the purpose of this PR

Fix test fail when use java 9 or above.

Which issue(s) this PR fixes:

NONE

Brief changelog

Use equals to compare properties directly.

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.

details

Consider code like follow

import java.util.Properties;

public class Main {

  public static void main(String[] args) {
    Properties a = new Properties();
    a.put("x", "0");

    Properties b = new Properties();
    b.put("x", "0");

    System.out.println(a.equals(b));
    System.out.println(a.entrySet().equals(b.entrySet()));
  }
}

In Jdk 8, the output will be

true
true

But in Jdk 9 or above, the output will change to

true
false

One can run it on website https://www.jdoodle.com/online-java-compiler/

So it need to compare properties directly instread of using entrySet.

@codecov-commenter
Copy link

Codecov Report

Merging #3667 (31c0500) into master (6deedb3) will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3667      +/-   ##
============================================
+ Coverage     50.95%   50.96%   +0.01%     
- Complexity     2329     2330       +1     
============================================
  Files           449      449              
  Lines         14026    14026              
  Branches       1426     1426              
============================================
+ Hits           7147     7149       +2     
+ Misses         6392     6391       -1     
+ Partials        487      486       -1     
Impacted Files Coverage Δ Complexity Δ
...lo/configservice/util/InstanceConfigAuditUtil.java 74.35% <0.00%> (-1.71%) 15.00% <0.00%> (ø%)
.../apollo/internals/RemoteConfigLongPollService.java 77.10% <0.00%> (-1.21%) 28.00% <0.00%> (-1.00%)
...ervice/service/ReleaseMessageServiceWithCache.java 87.05% <0.00%> (+1.17%) 25.00% <0.00%> (+1.00%)
...ework/apollo/internals/RemoteConfigRepository.java 89.37% <0.00%> (+3.12%) 25.00% <0.00%> (+1.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 6deedb3...31c0500. Read the comment docs.

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 21ac89c into apolloconfig:master May 9, 2021
@nobodyiam nobodyiam added this to the 1.9.0 milestone May 23, 2021
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