mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: merge two tests
GitOrigin-RevId: 3811faf0c478ae7e9e2c7ff40da645ef41312d09
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d009fb0ae7
commit
c47a581888
-42
@@ -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")
|
||||
}
|
||||
}
|
||||
+20
-23
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user