From 9df2dc6cdb5e9fee33da163c566f1d6a543e4944 Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Wed, 7 Nov 2018 21:52:05 +0300 Subject: [PATCH] introduce LightPlatform4TestCase for JUnit4 tests --- .../testFramework/LightPlatform4TestCase.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 platform/testFramework/src/com/intellij/testFramework/LightPlatform4TestCase.java diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatform4TestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatform4TestCase.java new file mode 100644 index 000000000000..e626b786c503 --- /dev/null +++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatform4TestCase.java @@ -0,0 +1,32 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.testFramework; + +import com.intellij.openapi.util.text.StringUtil; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.TestName; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** + * @author gregsh + */ +@RunWith(JUnit4.class) +public abstract class LightPlatform4TestCase extends LightPlatformTestCase { + @Rule + public final TestName myTestName = new TestName(); + + @Before + @Override + public void setUp() throws Exception { + setName("test" + StringUtil.capitalize(myTestName.getMethodName())); + super.setUp(); + } + + @After + @Override + public void tearDown() { + EdtTestUtil.runInEdtAndWait(() -> super.tearDown()); + } +}