diff --git a/java/java-tests/testData/inspection/java8MapApi/afterComputeIfAbsentUsedKey.java b/java/java-tests/testData/inspection/java8MapApi/afterComputeIfAbsentUsedKey.java index a35a993fe20f..ad17dd18f790 100644 --- a/java/java-tests/testData/inspection/java8MapApi/afterComputeIfAbsentUsedKey.java +++ b/java/java-tests/testData/inspection/java8MapApi/afterComputeIfAbsentUsedKey.java @@ -1,4 +1,4 @@ -// "Replace with 'computeIfAbsent' method call" "INFORMATION" +// "Replace with 'computeIfAbsent' method call" "GENERIC_ERROR_OR_WARNING" import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/java/java-tests/testData/inspection/java8MapApi/beforeComputeIfAbsentUsedKey.java b/java/java-tests/testData/inspection/java8MapApi/beforeComputeIfAbsentUsedKey.java index 4ed73df5ef2d..35d5eccecddc 100644 --- a/java/java-tests/testData/inspection/java8MapApi/beforeComputeIfAbsentUsedKey.java +++ b/java/java-tests/testData/inspection/java8MapApi/beforeComputeIfAbsentUsedKey.java @@ -1,4 +1,4 @@ -// "Replace with 'computeIfAbsent' method call" "INFORMATION" +// "Replace with 'computeIfAbsent' method call" "GENERIC_ERROR_OR_WARNING" import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/java18api/Java8MapApiInspectionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/java18api/Java8MapApiInspectionTest.java index bec68d81beb3..8d4f67004ed7 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/java18api/Java8MapApiInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/java18api/Java8MapApiInspectionTest.java @@ -5,11 +5,7 @@ import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCa import com.intellij.codeInspection.LocalInspectionTool; import com.intellij.codeInspection.java18api.Java8MapApiInspection; import org.jetbrains.annotations.NotNull; -import org.junit.Test; -import org.junit.experimental.runners.Enclosed; -import org.junit.runner.RunWith; -@RunWith(Enclosed.class) public class Java8MapApiInspectionTest extends LightQuickFixParameterizedTestCase { @Override protected LocalInspectionTool @NotNull [] configureLocalInspectionTools() { @@ -18,18 +14,6 @@ public class Java8MapApiInspectionTest extends LightQuickFixParameterizedTestCas return new LocalInspectionTool[]{inspection}; } - public static class ImplTest { - @Test - public void testNameCandidate() { - assertEquals("e", Java8MapApiInspection.getNameCandidate("element")); - assertEquals("t", Java8MapApiInspection.getNameCandidate("accessToken")); - assertEquals("s", Java8MapApiInspection.getNameCandidate("SQL")); - assertEquals("n", Java8MapApiInspection.getNameCandidate("myUserName")); - assertEquals("v", Java8MapApiInspection.getNameCandidate("___VAR")); - assertEquals("k", Java8MapApiInspection.getNameCandidate("_1")); - } - } - @Override protected String getBasePath() { return "/inspection/java8MapApi"; diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/java18api/Java8TestNameCandidateTest.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/java18api/Java8TestNameCandidateTest.java new file mode 100644 index 000000000000..965abf12260d --- /dev/null +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/java18api/Java8TestNameCandidateTest.java @@ -0,0 +1,37 @@ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.java.codeInspection.java18api; + +import com.intellij.codeInspection.java18api.Java8MapApiInspection; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class Java8TestNameCandidateTest { + private final String expected; + private final String actual; + + public Java8TestNameCandidateTest(String expected, String actual) { + this.expected = expected; + this.actual = actual; + } + + @Parameterized.Parameters + public static Object[][] primeNumbers() { + return new Object[][]{ + {"e", "element"}, + {"t", "accessToken"}, + {"s", "SQL"}, + {"n", "myUserName"}, + {"v", "___VAR"}, + {"k", "_1"}, + }; + } + + @Test + public void testNameCandidate() { + assertEquals(expected, Java8MapApiInspection.getNameCandidate(actual)); + } +}