diff --git a/generators/org/jetbrains/jet/generators/tests/GenerateTests.java b/generators/org/jetbrains/jet/generators/tests/GenerateTests.java
index 85a0e70ec87..409552aab29 100644
--- a/generators/org/jetbrains/jet/generators/tests/GenerateTests.java
+++ b/generators/org/jetbrains/jet/generators/tests/GenerateTests.java
@@ -264,6 +264,27 @@ public class GenerateTests {
AbstractSurroundWithTest.class,
testModel("idea/testData/codeInsight/surroundWith/when", "doTestWithWhenSurrounder")
);
+
+ generateTest(
+ "idea/tests/",
+ "SurroundWithTryCatchTestGenerated",
+ AbstractSurroundWithTest.class,
+ testModel("idea/testData/codeInsight/surroundWith/tryCatch", "doTestWithTryCatchSurrounder")
+ );
+
+ generateTest(
+ "idea/tests/",
+ "SurroundWithTryCatchFinallyTestGenerated",
+ AbstractSurroundWithTest.class,
+ testModel("idea/testData/codeInsight/surroundWith/tryCatchFinally", "doTestWithTryCatchFinallySurrounder")
+ );
+
+ generateTest(
+ "idea/tests/",
+ "SurroundWithTryFinallyTestGenerated",
+ AbstractSurroundWithTest.class,
+ testModel("idea/testData/codeInsight/surroundWith/tryFinally", "doTestWithTryFinallySurrounder")
+ );
}
private static SimpleTestClassModel testModel(@NotNull String rootPath) {
diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinStatementSurroundDescriptor.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinStatementSurroundDescriptor.java
index dd39cd43680..166e215be09 100644
--- a/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinStatementSurroundDescriptor.java
+++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinStatementSurroundDescriptor.java
@@ -27,7 +27,10 @@ public class KotlinStatementSurroundDescriptor implements SurroundDescriptor {
private static final Surrounder[] SURROUNDERS = {
new KotlinIfSurrounder(),
- new KotlinIfElseSurrounder()
+ new KotlinIfElseSurrounder(),
+ new KotlinTryFinallySurrounder(),
+ new KotlinTryCatchFinallySurrounder(),
+ new KotlinTryCatchSurrounder()
};
@NotNull
diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTryCatchFinallySurrounder.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTryCatchFinallySurrounder.java
new file mode 100644
index 00000000000..f784707d8ba
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTryCatchFinallySurrounder.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.codeInsight.surroundWith.statement;
+
+import com.intellij.codeInsight.CodeInsightBundle;
+import com.intellij.openapi.util.TextRange;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jet.lang.psi.JetTryExpression;
+
+public class KotlinTryCatchFinallySurrounder extends KotlinTrySurrounderBase {
+
+ @Override
+ protected String getCodeTemplate() {
+ return "try { \n} catch(e: Exception) {\n} finally {\n}";
+ }
+
+ @NotNull
+ @Override
+ protected TextRange getTextRangeForCaret(@NotNull JetTryExpression expression) {
+ return getCatchTypeParameterTextRange(expression);
+ }
+
+ @Override
+ public String getTemplateDescription() {
+ return CodeInsightBundle.message("surround.with.try.catch.finally.template");
+ }
+}
diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTryCatchSurrounder.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTryCatchSurrounder.java
new file mode 100644
index 00000000000..fa28200a5fb
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTryCatchSurrounder.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.codeInsight.surroundWith.statement;
+
+import com.intellij.codeInsight.CodeInsightBundle;
+import com.intellij.openapi.util.TextRange;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jet.lang.psi.JetTryExpression;
+
+public class KotlinTryCatchSurrounder extends KotlinTrySurrounderBase {
+
+ @Override
+ protected String getCodeTemplate() {
+ return "try { \n} catch(e: Exception) {\n}";
+ }
+
+ @NotNull
+ @Override
+ protected TextRange getTextRangeForCaret(@NotNull JetTryExpression expression) {
+ return getCatchTypeParameterTextRange(expression);
+ }
+
+ @Override
+ public String getTemplateDescription() {
+ return CodeInsightBundle.message("surround.with.try.catch.template");
+ }
+}
diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTryFinallySurrounder.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTryFinallySurrounder.java
new file mode 100644
index 00000000000..85e6119aed0
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTryFinallySurrounder.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.codeInsight.surroundWith.statement;
+
+import com.intellij.codeInsight.CodeInsightBundle;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jet.lang.psi.JetElement;
+import org.jetbrains.jet.lang.psi.JetFinallySection;
+import org.jetbrains.jet.lang.psi.JetTryExpression;
+
+public class KotlinTryFinallySurrounder extends KotlinTrySurrounderBase {
+
+ @Override
+ protected String getCodeTemplate() {
+ return "try { \n} finally {\nb\n}";
+ }
+
+ @Nullable
+ @Override
+ protected TextRange surroundStatements(@NotNull Project project, @NotNull Editor editor, @NotNull PsiElement container, @NotNull PsiElement[] statements) {
+ TextRange textRange = super.surroundStatements(project, editor, container, statements);
+ assert textRange != null;
+ // Delete dummy "b" element for caret
+ editor.getDocument().deleteString(textRange.getStartOffset(), textRange.getEndOffset());
+ return new TextRange(textRange.getStartOffset(), textRange.getStartOffset());
+ }
+
+ @NotNull
+ @Override
+ protected TextRange getTextRangeForCaret(@NotNull JetTryExpression expression) {
+ JetFinallySection block = expression.getFinallyBlock();
+ assert block != null : "Finally block should exists for " + expression.getText();
+ JetElement blockExpression = block.getFinalExpression().getStatements().get(0);
+ return blockExpression.getTextRange();
+ }
+
+ @Override
+ public String getTemplateDescription() {
+ return CodeInsightBundle.message("surround.with.try.finally.template");
+ }
+}
diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTrySurrounderBase.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTrySurrounderBase.java
new file mode 100644
index 00000000000..429ff073406
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/surroundWith/statement/KotlinTrySurrounderBase.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.codeInsight.surroundWith.statement;
+
+import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jet.lang.psi.*;
+import org.jetbrains.jet.plugin.codeInsight.surroundWith.KotlinSurrounderUtils;
+
+public abstract class KotlinTrySurrounderBase extends KotlinStatementsSurrounder {
+
+ @Nullable
+ @Override
+ protected TextRange surroundStatements(@NotNull Project project, @NotNull Editor editor, @NotNull PsiElement container, @NotNull PsiElement[] statements) {
+ // TODO extract variables declaration
+
+ JetTryExpression tryExpression = (JetTryExpression) JetPsiFactory.createExpression(project, getCodeTemplate());
+ tryExpression = (JetTryExpression) container.addAfter(tryExpression, statements[statements.length - 1]);
+
+ // TODO move a comment for first statement
+
+ final JetBlockExpression tryBlock = tryExpression.getTryBlock();
+ // Add statements in try block of created try - catch - finally
+ KotlinSurrounderUtils.addStatementsInBlock(tryBlock, statements);
+
+ // Delete statements from original code
+ container.deleteChildRange(statements[0], statements[statements.length - 1]);
+
+ tryExpression = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(tryExpression);
+
+ return getTextRangeForCaret(tryExpression);
+ }
+
+ protected abstract String getCodeTemplate();
+
+ @NotNull
+ protected abstract TextRange getTextRangeForCaret(@NotNull JetTryExpression expression);
+
+ protected static TextRange getCatchTypeParameterTextRange(@NotNull JetTryExpression expression) {
+ JetParameter parameter = expression.getCatchClauses().get(0).getCatchParameter();
+ assert parameter != null : "Catch parameter should exists for " + expression.getText();
+ JetElement typeReference = parameter.getTypeReference();
+ assert typeReference != null : "Type reference for parameter should exists for " + expression.getText();
+ return typeReference.getTextRange();
+ }
+
+}
diff --git a/idea/testData/codeInsight/surroundWith/tryCatch/multiExpression.kt b/idea/testData/codeInsight/surroundWith/tryCatch/multiExpression.kt
new file mode 100644
index 00000000000..9d25e44e722
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryCatch/multiExpression.kt
@@ -0,0 +1,4 @@
+fun foo() {
+ "aaa"
+ "aaa"
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryCatch/multiExpression.kt.after b/idea/testData/codeInsight/surroundWith/tryCatch/multiExpression.kt.after
new file mode 100644
index 00000000000..584f80e1927
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryCatch/multiExpression.kt.after
@@ -0,0 +1,7 @@
+fun foo() {
+ try {
+ "aaa"
+ "aaa"
+ } catch(e: Exception) {
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryCatch/singleExpression.kt b/idea/testData/codeInsight/surroundWith/tryCatch/singleExpression.kt
new file mode 100644
index 00000000000..be970406931
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryCatch/singleExpression.kt
@@ -0,0 +1,3 @@
+fun foo() {
+ "aaa"
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryCatch/singleExpression.kt.after b/idea/testData/codeInsight/surroundWith/tryCatch/singleExpression.kt.after
new file mode 100644
index 00000000000..d70b2a0ac1f
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryCatch/singleExpression.kt.after
@@ -0,0 +1,6 @@
+fun foo() {
+ try {
+ "aaa"
+ } catch(e: Exception) {
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryCatchFinally/multiExpression.kt b/idea/testData/codeInsight/surroundWith/tryCatchFinally/multiExpression.kt
new file mode 100644
index 00000000000..9d25e44e722
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryCatchFinally/multiExpression.kt
@@ -0,0 +1,4 @@
+fun foo() {
+ "aaa"
+ "aaa"
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryCatchFinally/multiExpression.kt.after b/idea/testData/codeInsight/surroundWith/tryCatchFinally/multiExpression.kt.after
new file mode 100644
index 00000000000..151829078b3
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryCatchFinally/multiExpression.kt.after
@@ -0,0 +1,8 @@
+fun foo() {
+ try {
+ "aaa"
+ "aaa"
+ } catch(e: Exception) {
+ } finally {
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryCatchFinally/singleExpression.kt b/idea/testData/codeInsight/surroundWith/tryCatchFinally/singleExpression.kt
new file mode 100644
index 00000000000..be970406931
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryCatchFinally/singleExpression.kt
@@ -0,0 +1,3 @@
+fun foo() {
+ "aaa"
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryCatchFinally/singleExpression.kt.after b/idea/testData/codeInsight/surroundWith/tryCatchFinally/singleExpression.kt.after
new file mode 100644
index 00000000000..909df4945e4
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryCatchFinally/singleExpression.kt.after
@@ -0,0 +1,7 @@
+fun foo() {
+ try {
+ "aaa"
+ } catch(e: Exception) {
+ } finally {
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryFinally/multiExpression.kt b/idea/testData/codeInsight/surroundWith/tryFinally/multiExpression.kt
new file mode 100644
index 00000000000..9d25e44e722
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryFinally/multiExpression.kt
@@ -0,0 +1,4 @@
+fun foo() {
+ "aaa"
+ "aaa"
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryFinally/multiExpression.kt.after b/idea/testData/codeInsight/surroundWith/tryFinally/multiExpression.kt.after
new file mode 100644
index 00000000000..7cc09c94e42
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryFinally/multiExpression.kt.after
@@ -0,0 +1,8 @@
+fun foo() {
+ try {
+ "aaa"
+ "aaa"
+ } finally {
+
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryFinally/singleExpression.kt b/idea/testData/codeInsight/surroundWith/tryFinally/singleExpression.kt
new file mode 100644
index 00000000000..be970406931
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryFinally/singleExpression.kt
@@ -0,0 +1,3 @@
+fun foo() {
+ "aaa"
+}
\ No newline at end of file
diff --git a/idea/testData/codeInsight/surroundWith/tryFinally/singleExpression.kt.after b/idea/testData/codeInsight/surroundWith/tryFinally/singleExpression.kt.after
new file mode 100644
index 00000000000..c8c8adcb9c5
--- /dev/null
+++ b/idea/testData/codeInsight/surroundWith/tryFinally/singleExpression.kt.after
@@ -0,0 +1,7 @@
+fun foo() {
+ try {
+ "aaa"
+ } finally {
+
+ }
+}
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/AbstractSurroundWithTest.java b/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/AbstractSurroundWithTest.java
index c85e05516fb..ddff38650e5 100644
--- a/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/AbstractSurroundWithTest.java
+++ b/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/AbstractSurroundWithTest.java
@@ -23,8 +23,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.plugin.codeInsight.surroundWith.expression.KotlinNotSurrounder;
import org.jetbrains.jet.plugin.codeInsight.surroundWith.expression.KotlinParenthesesSurrounder;
import org.jetbrains.jet.plugin.codeInsight.surroundWith.expression.KotlinStringTemplateSurrounder;
-import org.jetbrains.jet.plugin.codeInsight.surroundWith.statement.KotlinIfElseSurrounder;
-import org.jetbrains.jet.plugin.codeInsight.surroundWith.statement.KotlinIfSurrounder;
+import org.jetbrains.jet.plugin.codeInsight.surroundWith.expression.KotlinWhenSurrounder;
+import org.jetbrains.jet.plugin.codeInsight.surroundWith.statement.*;
public abstract class AbstractSurroundWithTest extends LightCodeInsightTestCase {
@@ -47,6 +47,22 @@ public abstract class AbstractSurroundWithTest extends LightCodeInsightTestCase
public void doTestWithStringTemplateSurrounder(String path) throws Exception {
doTest(path, new KotlinStringTemplateSurrounder());
}
+
+ public void doTestWithWhenSurrounder(String path) throws Exception {
+ doTest(path, new KotlinWhenSurrounder());
+ }
+
+ public void doTestWithTryCatchSurrounder(String path) throws Exception {
+ doTest(path, new KotlinTryCatchSurrounder());
+ }
+
+ public void doTestWithTryCatchFinallySurrounder(String path) throws Exception {
+ doTest(path, new KotlinTryCatchFinallySurrounder());
+ }
+
+ public void doTestWithTryFinallySurrounder(String path) throws Exception {
+ doTest(path, new KotlinTryFinallySurrounder());
+ }
private void doTest(String path, Surrounder surrounder) throws Exception{
configureByFile(path);
diff --git a/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/SurroundWithTryCatchFinallyTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/SurroundWithTryCatchFinallyTestGenerated.java
new file mode 100644
index 00000000000..5e3df69b778
--- /dev/null
+++ b/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/SurroundWithTryCatchFinallyTestGenerated.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.codeInsight.surroundWith;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import java.io.File;
+import java.util.regex.Pattern;
+import org.jetbrains.jet.JetTestUtils;
+import org.jetbrains.jet.test.InnerTestClasses;
+import org.jetbrains.jet.test.TestMetadata;
+
+import org.jetbrains.jet.plugin.codeInsight.surroundWith.AbstractSurroundWithTest;
+
+/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
+@SuppressWarnings("all")
+@TestMetadata("idea/testData/codeInsight/surroundWith/tryCatchFinally")
+public class SurroundWithTryCatchFinallyTestGenerated extends AbstractSurroundWithTest {
+ public void testAllFilesPresentInTryCatchFinally() throws Exception {
+ JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/surroundWith/tryCatchFinally"), Pattern.compile("^(.+)\\.kt$"), true);
+ }
+
+ @TestMetadata("multiExpression.kt")
+ public void testMultiExpression() throws Exception {
+ doTestWithTryCatchFinallySurrounder("idea/testData/codeInsight/surroundWith/tryCatchFinally/multiExpression.kt");
+ }
+
+ @TestMetadata("singleExpression.kt")
+ public void testSingleExpression() throws Exception {
+ doTestWithTryCatchFinallySurrounder("idea/testData/codeInsight/surroundWith/tryCatchFinally/singleExpression.kt");
+ }
+
+}
diff --git a/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/SurroundWithTryCatchTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/SurroundWithTryCatchTestGenerated.java
new file mode 100644
index 00000000000..ede3e22c749
--- /dev/null
+++ b/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/SurroundWithTryCatchTestGenerated.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.codeInsight.surroundWith;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import java.io.File;
+import java.util.regex.Pattern;
+import org.jetbrains.jet.JetTestUtils;
+import org.jetbrains.jet.test.InnerTestClasses;
+import org.jetbrains.jet.test.TestMetadata;
+
+import org.jetbrains.jet.plugin.codeInsight.surroundWith.AbstractSurroundWithTest;
+
+/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
+@SuppressWarnings("all")
+@TestMetadata("idea/testData/codeInsight/surroundWith/tryCatch")
+public class SurroundWithTryCatchTestGenerated extends AbstractSurroundWithTest {
+ public void testAllFilesPresentInTryCatch() throws Exception {
+ JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/surroundWith/tryCatch"), Pattern.compile("^(.+)\\.kt$"), true);
+ }
+
+ @TestMetadata("multiExpression.kt")
+ public void testMultiExpression() throws Exception {
+ doTestWithTryCatchSurrounder("idea/testData/codeInsight/surroundWith/tryCatch/multiExpression.kt");
+ }
+
+ @TestMetadata("singleExpression.kt")
+ public void testSingleExpression() throws Exception {
+ doTestWithTryCatchSurrounder("idea/testData/codeInsight/surroundWith/tryCatch/singleExpression.kt");
+ }
+
+}
diff --git a/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/SurroundWithTryFinallyTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/SurroundWithTryFinallyTestGenerated.java
new file mode 100644
index 00000000000..0269c758b52
--- /dev/null
+++ b/idea/tests/org/jetbrains/jet/plugin/codeInsight/surroundWith/SurroundWithTryFinallyTestGenerated.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin.codeInsight.surroundWith;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import java.io.File;
+import java.util.regex.Pattern;
+import org.jetbrains.jet.JetTestUtils;
+import org.jetbrains.jet.test.InnerTestClasses;
+import org.jetbrains.jet.test.TestMetadata;
+
+import org.jetbrains.jet.plugin.codeInsight.surroundWith.AbstractSurroundWithTest;
+
+/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
+@SuppressWarnings("all")
+@TestMetadata("idea/testData/codeInsight/surroundWith/tryFinally")
+public class SurroundWithTryFinallyTestGenerated extends AbstractSurroundWithTest {
+ public void testAllFilesPresentInTryFinally() throws Exception {
+ JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/surroundWith/tryFinally"), Pattern.compile("^(.+)\\.kt$"), true);
+ }
+
+ @TestMetadata("multiExpression.kt")
+ public void testMultiExpression() throws Exception {
+ doTestWithTryFinallySurrounder("idea/testData/codeInsight/surroundWith/tryFinally/multiExpression.kt");
+ }
+
+ @TestMetadata("singleExpression.kt")
+ public void testSingleExpression() throws Exception {
+ doTestWithTryFinallySurrounder("idea/testData/codeInsight/surroundWith/tryFinally/singleExpression.kt");
+ }
+
+}