Files
openide/java/java-tests/testSrc/com/siyeh/ig/fixes/dataflow/CreateNullBranchFixTest.java
Tagir Valeev aa6829d7c1 [java-tests] IDEA-333831 Separate mock JDK and JetBrains annotations for testing
Also: avoid manual mocking of Java 10 classes in StreamCollector10Inlining test, use mockJDK11 instead
Also: rewrite SliceTestCase and its inheritors to LightJavaCodeInsightFixtureTestCase, as annotations.jar is not included into project created by DaemonAnalyzerTestCase
Also: 'mutates' attribute of @Contract annotation is resolvable now, as we can use newer jetbrains-annotations library.
Also: documentation tests now don't generate links to JetBrains annotations, which corresponds to the actual behavior in production

GitOrigin-RevId: e460826893c1277cb2b78b18aae9d5aca97d8333
2023-10-05 11:24:29 +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::addJetBrainsAnnotations);
}
@Override
protected void tuneFixture(JavaModuleFixtureBuilder builder) throws Exception {
builder.setLanguageLevel(LanguageLevel.JDK_20_PREVIEW);
}
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"));
}
}