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);
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