Files
openide/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBePrimitivePatternSwitchFixTest.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

66 lines
3.3 KiB
Java

// 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.fixes.migration;
import com.intellij.codeInspection.CommonQuickFixBundle;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.pom.java.JavaFeature;
import com.intellij.psi.PsiKeyword;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor;
import com.siyeh.ig.IGQuickFixesTestCase;
import com.siyeh.ig.migration.IfCanBeSwitchInspection;
public class IfCanBePrimitivePatternSwitchFixTest extends IGQuickFixesTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
final IfCanBeSwitchInspection inspection = new IfCanBeSwitchInspection();
inspection.minimumBranches = 2;
myFixture.enableInspections(inspection);
myRelativePath = "migration/if_can_be_switch";
myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", PsiKeyword.IF, PsiKeyword.SWITCH);
ModuleRootModificationUtil.updateModel(getModule(), DefaultLightProjectDescriptor::addJetBrainsAnnotationsWithTypeUse);
}
@Override
protected void tuneFixture(JavaModuleFixtureBuilder builder) throws Exception {
super.tuneFixture(builder);
builder.setLanguageLevel(JavaFeature.PRIMITIVE_TYPES_IN_PATTERNS.getMinimumLevel());
builder.addJdk(IdeaTestUtil.getMockJdk18Path().getPath());
}
public void testPrimitiveIntType() { doTest(); }
public void testPrimitiveIntTypeWithDifferent() { assertQuickfixNotAvailable(); }
public void testPrimitiveIntTypeWithDifferentRevert() { assertQuickfixNotAvailable(); }
public void testPrimitiveIntTypeRevert() { doTest(); }
public void testPrimitiveIntTypeRevertComparison() { doTest(); }
public void testPrimitiveIntTypeComparison() { doTest(); }
public void testPrimitiveLongIntType() { assertQuickfixNotAvailable(); }
public void testPrimitiveLongType() { doTest(); }
public void testPrimitiveLongType2() { doTest(); }
public void testPrimitiveLongType3() { doTest(); }
public void testPrimitiveIntegerNullType() { doTest(); }
public void testPrimitiveIntegerNullType2() { doTest(); }
public void testPrimitiveIntegerNullType3() { doTest(); }
public void testPrimitiveIntegerNotNullType() { doTest(); }
public void testPrimitiveIntegerNotNullType2() { doTest(); }
public void testPrimitiveIntegerNotNullType3() { doTest(); }
public void testPrimitiveLongObjectNullType() { doTest(); }
public void testPrimitiveLongObjectNullType2() { doTest(); }
public void testPrimitiveLongObjectNullType3() { doTest(); }
public void testPrimitiveLongObjectNotNullType() { doTest(); }
public void testPrimitiveLongObjectNotNullType2() { doTest(); }
public void testPrimitiveLongObjectNotNullType3() { doTest(); }
public void testComparisonWithPrimitives1() { doTest(); }
public void testComparisonWithPrimitives2() { doTest(); }
public void testComparisonWithPrimitives3() { doTest(); }
public void testComparisonNonPrimitive() { assertQuickfixNotAvailable(); }
public void testDoubleComparison() { assertQuickfixNotAvailable(); }
public void testPrimitiveDominates() { assertQuickfixNotAvailable(); }
}