diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseBlockWithIf.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseBlockWithIf.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseBlockWithIf.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseBlockWithIf.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseBlockWithIf_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseBlockWithIf_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseBlockWithIf_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseBlockWithIf_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseResultWithIf.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseResultWithIf.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseResultWithIf.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseResultWithIf.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseResultWithIf_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseResultWithIf_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseResultWithIf_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseResultWithIf_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseResultWithSynchronized.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseResultWithSynchronized.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseResultWithSynchronized.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseResultWithSynchronized.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseResultWithSynchronized_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseResultWithSynchronized_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseResultWithSynchronized_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseResultWithSynchronized_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithBlock.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithBlock.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithBlock.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithBlock.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithBlock_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithBlock_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithBlock_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithBlock_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithIf.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithIf.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithIf.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithIf.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithIf_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithIf_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithIf_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithIf_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithTryCatch.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithTryCatch.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithTryCatch.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithTryCatch.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithTryCatch_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithTryCatch_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CaseThrowWithTryCatch_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CaseThrowWithTryCatch_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CatchBlockWithFor.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CatchBlockWithFor.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CatchBlockWithFor.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CatchBlockWithFor.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CatchBlockWithFor_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CatchBlockWithFor_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CatchBlockWithFor_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CatchBlockWithFor_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CatchResultWithFor.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CatchResultWithFor.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CatchResultWithFor.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CatchResultWithFor.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/CatchResultWithFor_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/CatchResultWithFor_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/CatchResultWithFor_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/CatchResultWithFor_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultBlockWithDoWhile.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultBlockWithDoWhile.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultBlockWithDoWhile.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultBlockWithDoWhile.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultBlockWithDoWhile_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultBlockWithDoWhile_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultBlockWithDoWhile_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultBlockWithDoWhile_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultBlockWithTryFinally.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultBlockWithTryFinally.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultBlockWithTryFinally.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultBlockWithTryFinally.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultBlockWithTryFinally_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultBlockWithTryFinally_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultBlockWithTryFinally_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultBlockWithTryFinally_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithRunnable.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithRunnable.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithRunnable.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithRunnable.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithRunnable_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithRunnable_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithRunnable_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithRunnable_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithTryCatchFinally.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithTryCatchFinally.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithTryCatchFinally.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithTryCatchFinally.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithTryCatchFinally_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithTryCatchFinally_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithTryCatchFinally_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithTryCatchFinally_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithWhile.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithWhile.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithWhile.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithWhile.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithWhile_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithWhile_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultResultWithWhile_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultResultWithWhile_after.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultThrowWithIfElse.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultThrowWithIfElse.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultThrowWithIfElse.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultThrowWithIfElse.java diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultThrowWithIfElse_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultThrowWithIfElse_after.java similarity index 100% rename from java/java-tests/testData/codeInsight/generation/surroundWith/java13/DefaultThrowWithIfElse_after.java rename to java/java-tests/testData/codeInsight/generation/surroundWith/java/DefaultThrowWithIfElse_after.java diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/generation/surroundWith/JavaSurroundWith12Test.kt b/java/java-tests/testSrc/com/intellij/java/codeInsight/generation/surroundWith/JavaSurroundWith12Test.kt deleted file mode 100644 index 5292a1e9d089..000000000000 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/generation/surroundWith/JavaSurroundWith12Test.kt +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.java.codeInsight.generation.surroundWith - -import com.intellij.codeInsight.generation.surroundWith.* -import com.intellij.lang.LanguageSurrounders -import com.intellij.lang.java.JavaLanguage -import com.intellij.lang.surroundWith.Surrounder -import com.intellij.testFramework.LightJavaCodeInsightTestCase -import com.intellij.util.containers.ContainerUtil - -class JavaSurroundWith13Test : LightJavaCodeInsightTestCase() { - private val BASE_PATH = "/codeInsight/generation/surroundWith/java13/" - - fun testCaseBlockWithIf() = doTest(JavaWithIfSurrounder()) - fun testCaseResultWithIf() = doTest(JavaWithIfSurrounder()) - fun testCaseThrowWithIf() = doTest(JavaWithIfSurrounder()) - fun testCaseResultWithSynchronized() = doTest(JavaWithSynchronizedSurrounder()) - fun testDefaultBlockWithTryFinally() = doTest(JavaWithTryFinallySurrounder()) - fun testCaseThrowWithTryCatch() = doTest(JavaWithTryCatchSurrounder()) - fun testDefaultResultWithTryCatchFinally() = doTest(JavaWithTryCatchFinallySurrounder()) - fun testDefaultBlockWithDoWhile() = doTest(JavaWithDoWhileSurrounder()) - fun testCaseThrowWithBlock() = doTest(JavaWithBlockSurrounder()) - fun testDefaultResultWithRunnable() = doTest(JavaWithRunnableSurrounder()) - fun testCatchBlockWithFor() = doTest(JavaWithForSurrounder()) - fun testCatchResultWithFor() = doTest(JavaWithForSurrounder()) - fun testDefaultThrowWithIfElse() = doTest(JavaWithIfElseSurrounder()) - fun testDefaultResultWithWhile() = doTest(JavaWithWhileSurrounder()) - - private fun doTest(surrounder: Surrounder) { - val fileName = getTestName(false) - configureByFile("${BASE_PATH}${fileName}.java") - - val descriptor = ContainerUtil.getFirstItem(LanguageSurrounders.INSTANCE.allForLanguage(JavaLanguage.INSTANCE))!! - val selectionModel = getEditor().selectionModel - val elements = descriptor.getElementsToSurround(getFile(), selectionModel.selectionStart, selectionModel.selectionEnd) - assertTrue(surrounder.isApplicable(elements)) - - SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder) - - checkResultByFile("${BASE_PATH}${fileName}_after.java") - } -} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/generation/surroundWith/JavaSurroundWithTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/generation/surroundWith/JavaSurroundWithTest.java index 41f41d98bb89..136b0525c84b 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/generation/surroundWith/JavaSurroundWithTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/generation/surroundWith/JavaSurroundWithTest.java @@ -144,29 +144,26 @@ public class JavaSurroundWithTest extends LightJavaCodeInsightTestCase { doTest(new JavaWithCastSurrounder()); } - public void testSurroundWithNotNullCheck() { - doTest(new JavaWithNullCheckSurrounder()); - } - - public void testSurroundExpressionWithIf() { - doTest(new JavaWithIfExpressionSurrounder()); - } - - public void testSurroundExpressionWithIfForBoxedBooleans() { - doTest(new JavaWithIfExpressionSurrounder()); - } - - public void testSurroundExpressionWithNotForBoxedBooleans() { - doTest(new JavaWithNotSurrounder()); - } - - public void testSurroundExpressionWithElseIf() { - doTest(new JavaWithIfExpressionSurrounder()); - } - - public void testSurroundExpressionWithElseIfElse() { - doTest(new JavaWithIfElseExpressionSurrounder()); - } + public void testSurroundWithNotNullCheck() { doTest(new JavaWithNullCheckSurrounder()); } + public void testSurroundExpressionWithIf() { doTest(new JavaWithIfExpressionSurrounder()); } + public void testSurroundExpressionWithIfForBoxedBooleans() { doTest(new JavaWithIfExpressionSurrounder()); } + public void testSurroundExpressionWithNotForBoxedBooleans() { doTest(new JavaWithNotSurrounder()); } + public void testSurroundExpressionWithElseIf() { doTest(new JavaWithIfExpressionSurrounder()); } + public void testSurroundExpressionWithElseIfElse() { doTest(new JavaWithIfElseExpressionSurrounder()); } + public void testCaseBlockWithIf() { doTest(new JavaWithIfSurrounder()); } + public void testCaseResultWithIf() { doTest(new JavaWithIfSurrounder()); } + public void testCaseResultWithSynchronized() { doTest(new JavaWithSynchronizedSurrounder()); } + public void testCaseThrowWithBlock() { doTest(new JavaWithBlockSurrounder()); } + public void testCaseThrowWithIf() { doTest(new JavaWithIfSurrounder()); } + public void testCaseThrowWithTryCatch() { doTest(new JavaWithTryCatchSurrounder()); } + public void testCatchBlockWithFor() { doTest(new JavaWithForSurrounder()); } + public void testCatchResultWithFor() { doTest(new JavaWithForSurrounder()); } + public void testDefaultBlockWithDoWhile() { doTest(new JavaWithDoWhileSurrounder()); } + public void testDefaultBlockWithTryFinally() { doTest(new JavaWithTryFinallySurrounder()); } + public void testDefaultResultWithRunnable() { doTest(new JavaWithRunnableSurrounder()); } + public void testDefaultResultWithTryCatchFinally() { doTest(new JavaWithTryCatchFinallySurrounder()); } + public void testDefaultResultWithWhile() { doTest(new JavaWithWhileSurrounder()); } + public void testDefaultThrowWithIfElse() { doTest(new JavaWithIfElseSurrounder()); } public void testSurroundWithTryFinallyUsingIndents() { CommonCodeStyleSettings.IndentOptions indentOptions = getCurrentCodeStyleSettings().getIndentOptions(JavaFileType.INSTANCE);