Files
openide/java/java-tests/testSrc/com/siyeh/ig/fixes/dataflow/CreateNullBranchFixTest.java
Mikhail Pyltsin 092062f856 [java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations
- extract tests, which require old annotations
- return old name to method to add annotations

GitOrigin-RevId: c559cea10f942f72d5a19176d3ee808d46ad5dd2
2024-06-27 13:29:33 +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::addJetBrainsAnnotationsWithTypeUse);
}
@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"));
}
}