[JAVA] [JUnit5] Dealing with "the reference of assertEquals is ambiguous"

problem

If you call ʻorg.junit.jupiter.api.Assertions.assertEquals` with one primitive type and one object type as shown below, "* assertEquals reference is ambiguous org.junit.jupiter.api.Assertions. Both the method assertEquals (java.lang.Object, java.lang.Object) and the method assertEquals (int, int) in org.junit.jupiter.api.Assertions match * "and a compilation error occurs.

assertEquals(1, (Integer) 1);

Coping

It's okay if you cast either one. Basically, I think it's better to cast it to a primitive type.

assertEquals(1, (int) ((Integer) 1));

Recommended Posts

[JUnit5] Dealing with "the reference of assertEquals is ambiguous"
Overwrite the contents of config with Spring-boot + JUnit5
Test the contents of an Excel file with JUnit
'% 02d' What is the percentage of% 2?
[Reference example] Copyright is described in the comment of the source code.
Is the version of Elasticsearch you are using compatible with Java 11?
Check the contents of params with pry
What is testing? ・ About the importance of testing
What is the data structure of ActionText?
About the treatment of BigDecimal (with reflection)
Format the contents of LocalDate with DateTimeFormatter
What is JSP? ~ Let's know the basics of JSP !! ~
ActiveSupport underscore is not the inverse of camelize
The order of Java method modifiers is fixed
Easy JUnit test of Elasticsearch 2018 version with embedded-elasticsearch
Manage the version of Ruby itself with rbenv
The story of tuning android apps with libGDX
Calculate the similarity score of strings with JAVA
Prepare the environment of CentOS 8 with Sakura VPS
Specify the default value with @Builder of Lombok
Measure the distance of the maze with breadth-first search
The official name of Spring MVC is Spring Web MVC
[Java] The word passing by reference is bad!
I checked the number of taxis with Ruby