summaryrefslogtreecommitdiff
path: root/java/java-tests/testSrc/com/intellij/codeInsight/generation
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2013-04-01 14:41:51 -0700
committerJean-Baptiste Queru <jbq@google.com>2013-04-01 14:41:51 -0700
commit2bd2b7c2623d4266384e890271869efc044aabff (patch)
tree0b31f50e55975b6354ed458314e17b4441bb4e17 /java/java-tests/testSrc/com/intellij/codeInsight/generation
parent1d526b16d476792ca7ce47616d55833115e8d6ab (diff)
downloadidea-2bd2b7c2623d4266384e890271869efc044aabff.tar.gz
Snapshot ee98b298267d0e09d2cd2f0731b6480a56dd48e7 from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I4515f72af131fdea9fc6905a4dc0fe9532409a81
Diffstat (limited to 'java/java-tests/testSrc/com/intellij/codeInsight/generation')
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java65
1 files changed, 17 insertions, 48 deletions
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java
index c12ffac70e3b..a7aa17432d61 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java
@@ -15,7 +15,6 @@
*/
package com.intellij.codeInsight.generation.surroundWith;
-import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
import com.intellij.codeInsight.template.impl.TemplateState;
import com.intellij.lang.surroundWith.Surrounder;
@@ -107,47 +106,23 @@ public class JavaSurroundWithTest extends LightCodeInsightTestCase {
}
public void testSurroundBinaryWithCast() {
- final TemplateManagerImpl templateManager = (TemplateManagerImpl)TemplateManager.getInstance(getProject());
- templateManager.setTemplateTesting(true);
- try {
- doTest(getTestName(false), new JavaWithCastSurrounder());
- }
- finally {
- templateManager.setTemplateTesting(false);
- }
+ TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
+ doTest(getTestName(false), new JavaWithCastSurrounder());
}
public void testSurroundConditionalWithCast() {
- final TemplateManagerImpl templateManager = (TemplateManagerImpl)TemplateManager.getInstance(getProject());
- templateManager.setTemplateTesting(true);
- try {
- doTest(getTestName(false), new JavaWithCastSurrounder());
- }
- finally {
- templateManager.setTemplateTesting(false);
- }
+ TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
+ doTest(getTestName(false), new JavaWithCastSurrounder());
}
public void testSurroundAssignmentWithCast() {
- final TemplateManagerImpl templateManager = (TemplateManagerImpl)TemplateManager.getInstance(getProject());
- templateManager.setTemplateTesting(true);
- try {
- doTest(getTestName(false), new JavaWithCastSurrounder());
- }
- finally {
- templateManager.setTemplateTesting(false);
- }
+ TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
+ doTest(getTestName(false), new JavaWithCastSurrounder());
}
public void testSurroundWithNotNullCheck() {
- final TemplateManagerImpl templateManager = (TemplateManagerImpl)TemplateManager.getInstance(getProject());
- templateManager.setTemplateTesting(true);
- try {
- doTest(getTestName(false), new JavaWithNullCheckSurrounder());
- }
- finally {
- templateManager.setTemplateTesting(false);
- }
+ TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
+ doTest(getTestName(false), new JavaWithNullCheckSurrounder());
}
private void doTest(@NotNull String fileName, final Surrounder surrounder) {
@@ -158,22 +133,16 @@ public class JavaSurroundWithTest extends LightCodeInsightTestCase {
private void doTestWithTemplateFinish(@NotNull String fileName, final Surrounder surrounder, @Nullable String textToType)
throws Exception {
- final TemplateManagerImpl templateManager = (TemplateManagerImpl)TemplateManager.getInstance(getProject());
- try {
- templateManager.setTemplateTesting(true);
- configureByFile(BASE_PATH + fileName + ".java");
- SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder);
- if (textToType != null) {
- type(textToType);
- }
- TemplateState templateState = TemplateManagerImpl.getTemplateState(getEditor());
- assertNotNull(templateState);
- templateState.nextTab();
- checkResultByFile(BASE_PATH + fileName + "_after.java");
- }
- finally {
- templateManager.setTemplateTesting(false);
+ TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
+ configureByFile(BASE_PATH + fileName + ".java");
+ SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder);
+ if (textToType != null) {
+ type(textToType);
}
+ TemplateState templateState = TemplateManagerImpl.getTemplateState(getEditor());
+ assertNotNull(templateState);
+ templateState.nextTab();
+ checkResultByFile(BASE_PATH + fileName + "_after.java");
}
}