Files
openide/java/java-tests/testSrc/com/siyeh/ig/fixes/dataflow/CreateNullBranchFixTest.java
Mikhail Pyltsin 638393e895 [java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations
GitOrigin-RevId: d13187d41d214bd2ccadecb4cadc925f7d787d60
2024-06-26 20:34:48 +00:00

63 lines
2.2 KiB
Java

// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.siyeh.ig.fixes.dataflow;
import com.intellij.codeInspection.dataFlow.DataFlowInspection;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.IGQuickFixesTestCase;
public class CreateNullBranchFixTest extends IGQuickFixesTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
myFixture.enableInspections(new DataFlowInspection());
myRelativePath = "dataflow/create_null_branch";
ModuleRootModificationUtil.updateModel(getModule(), DefaultLightProjectDescriptor::addJetBrainsAnnotationsJava8AndHigher);
}
@Override
protected void tuneFixture(JavaModuleFixtureBuilder builder) throws Exception {
builder.setLanguageLevel(LanguageLevel.JDK_21);
}
public void testNoDefault() {
doTest(InspectionGadgetsBundle.message("create.null.branch.fix.family.name"));
}
public void testDefaultExists() {
doTest(InspectionGadgetsBundle.message("create.null.branch.fix.family.name"));
}
public void testPrevStatementCompletesNormally() {
doTest(InspectionGadgetsBundle.message("create.null.branch.fix.family.name"));
}
public void testRuleWithNoDefault() {
doTest(InspectionGadgetsBundle.message("create.null.branch.fix.family.name"));
}
public void testRuleWithDefaultExists() {
doTest(InspectionGadgetsBundle.message("create.null.branch.fix.family.name"));
}
public void testNullAlreadyExists() {
assertQuickfixNotAvailable(InspectionGadgetsBundle.message("create.null.branch.fix.family.name"));
}
public void testUnconditionalPatternExists() {
doTest(InspectionGadgetsBundle.message("create.null.branch.fix.family.name"));
}
public void testUnconditionalPatternNotExist() {
doTest(InspectionGadgetsBundle.message("create.null.branch.fix.family.name"));
}
public void testEmptyBody() {
doTest(InspectionGadgetsBundle.message("create.null.branch.fix.family.name"));
}
}