mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-134841 (Inspection: Misordered 'assertEquals' does not consider null as a literal)
This commit is contained in:
+1
-1
@@ -188,7 +188,7 @@ public abstract class MisorderedAssertEqualsArgumentsInspectionBase extends Base
|
||||
}
|
||||
|
||||
private boolean looksLikeExpectedArgument(PsiExpression expression) {
|
||||
if (ExpressionUtils.computeConstantExpression(expression) != null) {
|
||||
if (ExpressionUtils.computeConstantExpression(expression) != null || PsiType.NULL.equals(expression.getType())) {
|
||||
return true;
|
||||
}
|
||||
if (expression instanceof PsiReferenceExpression) {
|
||||
|
||||
+2
@@ -19,6 +19,8 @@ class Simple {
|
||||
TimeUnit timeUnit = TimeUnit.HOURS;
|
||||
Assert.<warning descr="Arguments to 'assertEquals()' in wrong order">assertEquals</warning>(timeUnit, TimeUnit.HOURS);
|
||||
Assert.<warning descr="Arguments to 'assertEquals()' in wrong order">assertEquals</warning>(test, map);
|
||||
|
||||
Assert.<warning descr="Arguments to 'assertEquals()' in wrong order">assertEquals</warning><error descr="'assertEquals(java.lang.String, long, long)' in 'org.junit.Assert' cannot be applied to '(java.lang.String, java.lang.Object, null)'">("message", new Object(), null)</error>;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ public class MisorderedAssertEqualsParametersInspectionTest extends LightInspect
|
||||
"package org.junit;" +
|
||||
"public class Assert {" +
|
||||
" static public void assertEquals(long expected, long actual) {}" +
|
||||
" static public void assertEquals(String message, long expected, long actual) {}" +
|
||||
" static public void assertEquals(Object expected, Object actual){}" +
|
||||
" static public void assertSame(Object expected, Object actual) {}" +
|
||||
"}",
|
||||
|
||||
Reference in New Issue
Block a user