assertEquals between incompatible types: ignore collections (IDEA-197547)

This commit is contained in:
Anna Kozlova
2018-08-20 17:07:50 +03:00
parent 69925d6f41
commit 514cd443e6
2 changed files with 2 additions and 1 deletions
@@ -195,7 +195,7 @@ public class AssertHint {
if (!objectType.equals(parameterType1) || !objectType.equals(parameterType2)) {
return null;
}
if (TypeUtils.areConvertible(type1, type2)) {
if (TypeUtils.areConvertible(type1, type2) || TypeUtils.mayBeEqualByContract(type1, type2)) {
return null;
}
final String comparedTypeText = type1.getPresentableText();
@@ -25,6 +25,7 @@ public class AssertEqualsBetweenInconvertibleTypes {
Collection<B> c2 = null;
assertEquals(c1, c2);
assertEquals(new ArrayList<String>(){}, new ArrayList<String>());
assertEquals(new TreeSet<String>(){}, new HashSet<String>());
}
interface A {}