mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: fix test that got a bit broken long ago
GitOrigin-RevId: 2a55678b0a8e426041f444bb24e642939aed4e34
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f16888f4f3
commit
8615693c0b
+1
-2
@@ -121,8 +121,7 @@ public final class InstanceVariableInitializationInspection extends BaseInspecti
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isInitializedInSetup(PsiField field,
|
||||
PsiClass aClass) {
|
||||
private static boolean isInitializedInSetup(PsiField field, PsiClass aClass) {
|
||||
final PsiMethod setupMethod = TestFrameworks.getInstance().findSetUpMethod(aClass);
|
||||
return InitializationUtils.methodAssignsVariableOrFails(setupMethod, field);
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,17 +1,17 @@
|
||||
package com.siyeh.igtest.initialization.field;
|
||||
|
||||
import <error descr="Cannot resolve symbol 'junit'">junit</error>.framework.TestCase;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class InstanceVariableInitialization extends <error descr="Cannot resolve symbol 'TestCase'">TestCase</error> { // needs junit.jar for testcase to work
|
||||
public class InstanceVariableInitialization extends TestCase {
|
||||
|
||||
private String <warning descr="Instance field 'javaHome' may not be initialized during object construction">javaHome</warning>;
|
||||
private String <warning descr="Instance field 'javaHome' may not be initialized during object construction or 'setUp()' call">javaHome</warning>;
|
||||
|
||||
InstanceVariableInitialization() {
|
||||
//javaHome = System.getProperty("java.home");
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.<error descr="Cannot resolve method 'setUp()'">setUp</error>();
|
||||
super.setUp();
|
||||
}
|
||||
}
|
||||
class InstanceVariableInitializationInspection
|
||||
|
||||
+7
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.siyeh.ig.initialization;
|
||||
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
@@ -19,6 +19,12 @@ public class InstanceVariableInitializationInspectionTest extends LightJavaCodeI
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.addClass("""
|
||||
package junit.framework;
|
||||
public class TestCase {
|
||||
protected void setUp() throws Exception {}
|
||||
}
|
||||
""");
|
||||
myFixture.enableInspections(new InstanceVariableInitializationInspection());
|
||||
myFixture.testHighlighting(getTestName(false) + ".java");
|
||||
}
|
||||
@@ -26,5 +32,4 @@ public class InstanceVariableInitializationInspectionTest extends LightJavaCodeI
|
||||
public void testInstanceVariableInitialization() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user