From 9eb02e318a4fb08f54a745eae29d19f07468be71 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 23 May 2012 20:45:51 +0400 Subject: [PATCH] Allow RelaxNG tests to run on their own classpath; drop unneeded cleanup code --- .../plugins/relaxNG/HighlightingTestBase.java | 32 ++++--------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java index 130ea0ef209a..2ff3bc720240 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java @@ -37,6 +37,7 @@ import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiReference; import com.intellij.testFramework.ExpectedHighlightingData; +import com.intellij.testFramework.PlatformTestCase; import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.UsefulTestCase; import com.intellij.testFramework.builders.EmptyModuleFixtureBuilder; @@ -51,42 +52,21 @@ import org.intellij.plugins.testUtil.IdeaCodeInsightTestCase; import org.intellij.plugins.testUtil.ResourceUtil; import org.jetbrains.annotations.NotNull; -import java.io.File; -import java.io.IOException; import java.util.Collection; -import static com.intellij.openapi.util.io.FileUtil.delete; - /** * Created by IntelliJ IDEA. * User: sweinreuter * Date: 25.07.2007 */ public abstract class HighlightingTestBase extends UsefulTestCase implements IdeaCodeInsightTestCase { - private static final File ourTempPath; - - private static final String JAVA_IO_TMPDIR = "java.io.tmpdir"; - - static { - // IDEA leaves bazillions of "ideaXXXX.ipr" files and "unitTestXXXX.tmp" directories in the temp directory - ourTempPath = new File(new File(System.getProperty(JAVA_IO_TMPDIR, "/tmp")), "test" + System.identityHashCode(Object.class)); - ourTempPath.mkdirs(); - - try { - System.setProperty(JAVA_IO_TMPDIR, ourTempPath.getCanonicalPath()); - Runtime.getRuntime().addShutdownHook(new Thread("Cleanup Temp") { - @Override - public void run() { - delete(ourTempPath); - } - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - protected CodeInsightTestFixture myTestFixture; + @SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors") + protected HighlightingTestBase() { + PlatformTestCase.initPlatformLangPrefix(); + } + protected void setUp() throws Exception { super.setUp(); final IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();