[devkit] RetrievingServiceInspection: fix tests

IJ-CR-102194

GitOrigin-RevId: b34950f81f00f95e966da6f299e05c255a4785f1
This commit is contained in:
Andrey Cherkasov
2023-04-12 14:51:42 +00:00
committed by intellij-monorepo-bot
parent 5a8799ac08
commit c27a5fdc2f
5 changed files with 3 additions and 6 deletions
@@ -8,7 +8,6 @@ final class MyService {
}
void foo() {
System.out.println(42);
MyService service = <weak_warning descr="Can be replaced with 'MyService.getInstance()' call">ApplicationManager.getApplication().getService<caret>(MyService.class)</weak_warning>;
}
}
@@ -8,7 +8,6 @@ final class MyService {
}
void foo() {
System.out.println(42);
MyService service = MyService.getInstance();
}
}
@@ -9,7 +9,6 @@ final class MyService {
}
void foo(Project project) {
System.out.println(42);
MyService service = <weak_warning descr="Can be replaced with 'MyService.getInstance()' call">project.getService<caret>(MyService.class)</weak_warning>;
}
}
@@ -9,7 +9,6 @@ final class MyService {
}
void foo(Project project) {
System.out.println(42);
MyService service = MyService.getInstance(project);
}
}
@@ -2,6 +2,7 @@
package org.jetbrains.idea.devkit.inspections
import com.intellij.testFramework.TestDataPath
import org.jetbrains.idea.devkit.DevKitBundle
import org.jetbrains.idea.devkit.DevkitJavaTestsUtil
import org.jetbrains.idea.devkit.inspections.quickfix.RetrievingServiceInspectionTestBase
@@ -21,10 +22,10 @@ internal class RetrievingServiceInspectionTest : RetrievingServiceInspectionTest
}
fun testReplaceWithGetInstanceApplicationLevel() {
doTest()
doTest(DevKitBundle.message("inspection.retrieving.service.replace.with", "MyService", "getInstance"))
}
fun testReplaceWithGetInstanceProjectLevel() {
doTest()
doTest(DevKitBundle.message("inspection.retrieving.service.replace.with", "MyService", "getInstance"))
}
}