mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
IJPL-53: Add parameter for RunInEdt JUnit5 annotation to take write intent lock. Turn off by default for JUnit5.
GitOrigin-RevId: 9093d3828cf88229b3c6a55ad48ccf2d1d201f47
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b10864ca70
commit
5ff20a1b4e
@@ -26,7 +26,7 @@ import java.util.jar.JarOutputStream;
|
|||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
public class ClsResolveTest {
|
public class ClsResolveTest {
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
public TempDirectoryExtension tempDir = new TempDirectoryExtension();
|
public TempDirectoryExtension tempDir = new TempDirectoryExtension();
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class ExcludePatternsInProjectFileIndexTest {
|
class ExcludePatternsInProjectFileIndexTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import org.junit.jupiter.params.ParameterizedTest
|
|||||||
import org.junit.jupiter.params.provider.EnumSource
|
import org.junit.jupiter.params.provider.EnumSource
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class OrderEntryGraphTest {
|
class OrderEntryGraphTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class OutputDirectoriesInProjectFileIndexTest {
|
class OutputDirectoriesInProjectFileIndexTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class PackageIndexTest {
|
class PackageIndexTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class UnloadedModulesInProjectFileIndexTest {
|
class UnloadedModulesInProjectFileIndexTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.intellij.testFramework.junit5.RunInEdt
|
|||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class PsiJavaModuleModificationTrackerTest : LightJavaCodeInsightFixtureTestCase5() {
|
class PsiJavaModuleModificationTrackerTest : LightJavaCodeInsightFixtureTestCase5() {
|
||||||
@Test
|
@Test
|
||||||
fun changeInPsiModuleInfo() {
|
fun changeInPsiModuleInfo() {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import org.junit.jupiter.api.Assertions
|
|||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class KotlinJUnit5AcceptanceTest : LightJavaCodeInsightFixtureTestCase5() {
|
class KotlinJUnit5AcceptanceTest : LightJavaCodeInsightFixtureTestCase5() {
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
internal fun setUp() {
|
internal fun setUp() {
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ class RwLockHolder(writeThread: Thread) {
|
|||||||
lock.writeIntentUnlock()
|
lock.writeIntentUnlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isWriteIntentLocked(): Boolean {
|
||||||
|
return lock.isWriteThread && (lock.isWriteIntentLocked || lock.isWriteAcquired)
|
||||||
|
}
|
||||||
|
|
||||||
fun runWithoutImplicitRead(runnable: Runnable) {
|
fun runWithoutImplicitRead(runnable: Runnable) {
|
||||||
if (isImplicitReadOnEDTDisabled) {
|
if (isImplicitReadOnEDTDisabled) {
|
||||||
runnable.run()
|
runnable.run()
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class ContentRootWithExcludedPatternsInProjectFileIndexTest {
|
class ContentRootWithExcludedPatternsInProjectFileIndexTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.io.File
|
|||||||
import kotlin.io.path.pathString
|
import kotlin.io.path.pathString
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class IteratingContentUnderExcludedTest {
|
class IteratingContentUnderExcludedTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import kotlin.test.assertEquals
|
|||||||
import kotlin.test.assertNull
|
import kotlin.test.assertNull
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
abstract class LibraryInProjectFileIndexTestCase {
|
abstract class LibraryInProjectFileIndexTestCase {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import org.junit.jupiter.api.extension.RegisterExtension
|
|||||||
import kotlin.test.assertFalse
|
import kotlin.test.assertFalse
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class ModuleRootsInProjectFileIndexTest {
|
class ModuleRootsInProjectFileIndexTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class NestedModuleAndLibraryRootsInProjectFileIndex {
|
class NestedModuleAndLibraryRootsInProjectFileIndex {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class NestedModuleRootsInProjectFileIndex {
|
class NestedModuleRootsInProjectFileIndex {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import java.nio.file.Path
|
|||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class NoIteratingUnderExcludedRootsTest {
|
class NoIteratingUnderExcludedRootsTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class SdkInProjectFileIndexTest {
|
class SdkInProjectFileIndexTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class SyntheticLibraryInProjectFileIndexTest {
|
class SyntheticLibraryInProjectFileIndexTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class UpdatingProjectFileIndexOnModuleRootFileModificationsTest {
|
class UpdatingProjectFileIndexOnModuleRootFileModificationsTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class NonRecursiveWorkspaceFileSetTest {
|
class NonRecursiveWorkspaceFileSetTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class WorkspaceFileIndexContributorDynamicRegistrationTest {
|
class WorkspaceFileIndexContributorDynamicRegistrationTest {
|
||||||
@JvmField
|
@JvmField
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public final class EdtTestUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ref<T> exception = new Ref<>();
|
Ref<T> exception = new Ref<>();
|
||||||
Runnable r = writeIntent ?
|
Runnable r = writeIntent && app == null ?
|
||||||
() -> {
|
() -> {
|
||||||
try {
|
try {
|
||||||
setupEventQueue();
|
setupEventQueue();
|
||||||
@@ -95,7 +95,7 @@ public final class EdtTestUtil {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (app != null) {
|
if (app != null && writeIntent) {
|
||||||
app.invokeAndWait(r);
|
app.invokeAndWait(r);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -10,19 +10,38 @@ import java.lang.annotation.Inherited
|
|||||||
* Instructs the framework to run methods in EDT.
|
* Instructs the framework to run methods in EDT.
|
||||||
* If [allMethods] is set to `true` (default), then all test class methods will be run in EDT, including lifecycle methods.
|
* If [allMethods] is set to `true` (default), then all test class methods will be run in EDT, including lifecycle methods.
|
||||||
* If [allMethods] is set to `false`, then methods annotated with [RunMethodInEdt] will be run in EDT.
|
* If [allMethods] is set to `false`, then methods annotated with [RunMethodInEdt] will be run in EDT.
|
||||||
|
* If [writeIntent] is set to `true`, then all test methods will be run with Write Intent Lock by default.
|
||||||
|
* If [writeIntent] is set to `false` (default), then all test methods will be run without Write Intent Lock by default.
|
||||||
*/
|
*/
|
||||||
@TestOnly
|
@TestOnly
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
@Inherited
|
@Inherited
|
||||||
@ExtendWith(EdtInterceptorExtension::class)
|
@ExtendWith(EdtInterceptorExtension::class)
|
||||||
annotation class RunInEdt(val allMethods: Boolean = true)
|
annotation class RunInEdt(val allMethods: Boolean = true, val writeIntent: Boolean = false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instructs the framework to run a single method in EDT. [RunInEdt] is required on the class level for this annotation to be picked up.
|
* Instructs the framework to run a single method in EDT. [RunInEdt] is required on the class level for this annotation to be picked up.
|
||||||
|
* If [writeIntent] is set to [WriteIntentMode.True], then test method will be run with Write Intent Lock.
|
||||||
|
* If [writeIntent] is set to [WriteIntentMode.False], then test method will be run without Write Intent Lock.
|
||||||
|
* If [writeIntent] is set to [WriteIntentMode.Default] (default), then Write Intent Lock is controlled by [RunInEdt.writeIntent].
|
||||||
*/
|
*/
|
||||||
@TestOnly
|
@TestOnly
|
||||||
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION)
|
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION)
|
||||||
annotation class RunMethodInEdt
|
annotation class RunMethodInEdt(val writeIntent: WriteIntentMode = WriteIntentMode.Default) {
|
||||||
|
/**
|
||||||
|
* Enumeration class that represents the mode for write intent.
|
||||||
|
*
|
||||||
|
* The WriteIntentMode enum class provides three possible modes:
|
||||||
|
* - True: Indicates that test must be run under Write Intent Lock.
|
||||||
|
* - False: Indicates that test must be run without Write Intent Lock.
|
||||||
|
* - Default: Indicates that the write intent lock is controlled by the parent annotation (see [RunInEdt]).
|
||||||
|
*
|
||||||
|
* This class is annotated with the @TestOnly annotation, indicating that it is intended
|
||||||
|
* for testing purposes only.
|
||||||
|
*/
|
||||||
|
@TestOnly
|
||||||
|
enum class WriteIntentMode { True, False, Default }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injects a test [disposable][com.intellij.openapi.Disposable] to a field or a parameter in a test.
|
* Injects a test [disposable][com.intellij.openapi.Disposable] to a field or a parameter in a test.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.intellij.testFramework.junit5.impl
|
|||||||
|
|
||||||
import com.intellij.testFramework.junit5.RunInEdt
|
import com.intellij.testFramework.junit5.RunInEdt
|
||||||
import com.intellij.testFramework.junit5.RunMethodInEdt
|
import com.intellij.testFramework.junit5.RunMethodInEdt
|
||||||
|
import com.intellij.testFramework.junit5.RunMethodInEdt.WriteIntentMode
|
||||||
import com.intellij.testFramework.runInEdtAndGet
|
import com.intellij.testFramework.runInEdtAndGet
|
||||||
import org.jetbrains.annotations.TestOnly
|
import org.jetbrains.annotations.TestOnly
|
||||||
import org.junit.jupiter.api.extension.DynamicTestInvocationContext
|
import org.junit.jupiter.api.extension.DynamicTestInvocationContext
|
||||||
@@ -64,7 +65,9 @@ internal class EdtInterceptorExtension : InvocationInterceptor {
|
|||||||
): T {
|
): T {
|
||||||
if (shouldIntercept(invocationContext)) {
|
if (shouldIntercept(invocationContext)) {
|
||||||
extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).put(testFactoryWasInterceptedKey, true)
|
extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).put(testFactoryWasInterceptedKey, true)
|
||||||
return intercept(invocation)
|
val writeIntent = getWriteIntent(invocationContext)
|
||||||
|
extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).put(testFactoryNeedsWriteIntentKey, writeIntent)
|
||||||
|
return intercept(invocation, writeIntent)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return invocation.proceed()
|
return invocation.proceed()
|
||||||
@@ -77,7 +80,8 @@ internal class EdtInterceptorExtension : InvocationInterceptor {
|
|||||||
extensionContext: ExtensionContext,
|
extensionContext: ExtensionContext,
|
||||||
) {
|
) {
|
||||||
if (extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).get(testFactoryWasInterceptedKey) == true) {
|
if (extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).get(testFactoryWasInterceptedKey) == true) {
|
||||||
intercept(invocation)
|
val writeIntent = extensionContext.getStore(ExtensionContext.Namespace.GLOBAL).get(testFactoryNeedsWriteIntentKey) as Boolean
|
||||||
|
intercept(invocation, writeIntent)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
invocation.proceed()
|
invocation.proceed()
|
||||||
@@ -104,10 +108,11 @@ internal class EdtInterceptorExtension : InvocationInterceptor {
|
|||||||
private companion object {
|
private companion object {
|
||||||
|
|
||||||
const val testFactoryWasInterceptedKey = "test factory was intercepted"
|
const val testFactoryWasInterceptedKey = "test factory was intercepted"
|
||||||
|
const val testFactoryNeedsWriteIntentKey = "test factory need write intent"
|
||||||
|
|
||||||
fun <T> intercept(invocation: Invocation<T>, invocationContext: ReflectiveInvocationContext<*>): T {
|
fun <T> intercept(invocation: Invocation<T>, invocationContext: ReflectiveInvocationContext<*>): T {
|
||||||
if (shouldIntercept(invocationContext)) {
|
if (shouldIntercept(invocationContext)) {
|
||||||
return intercept(invocation)
|
return intercept(invocation, getWriteIntent(invocationContext))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return invocation.proceed()
|
return invocation.proceed()
|
||||||
@@ -119,8 +124,23 @@ internal class EdtInterceptorExtension : InvocationInterceptor {
|
|||||||
return runInEdt.allMethods || AnnotationSupport.findAnnotation(invocationContext.executable, RunMethodInEdt::class.java).isPresent
|
return runInEdt.allMethods || AnnotationSupport.findAnnotation(invocationContext.executable, RunMethodInEdt::class.java).isPresent
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> intercept(invocation: Invocation<T>): T {
|
fun getWriteIntent(invocationContext: ReflectiveInvocationContext<*>): Boolean {
|
||||||
return runInEdtAndGet {
|
val runInEdt = AnnotationSupport.findAnnotation(invocationContext.targetClass, RunInEdt::class.java).get()
|
||||||
|
val runMethodInEdtOpt = AnnotationSupport.findAnnotation(invocationContext.executable, RunMethodInEdt::class.java)
|
||||||
|
if (runMethodInEdtOpt.isEmpty) {
|
||||||
|
return runInEdt.writeIntent
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
when (runMethodInEdtOpt.get().writeIntent) {
|
||||||
|
WriteIntentMode.True -> return true
|
||||||
|
WriteIntentMode.False -> return false
|
||||||
|
WriteIntentMode.Default -> return runInEdt.writeIntent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> intercept(invocation: Invocation<T>, writeIntent: Boolean): T {
|
||||||
|
return runInEdtAndGet(writeIntent) {
|
||||||
invocation.proceed()
|
invocation.proceed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||||
package com.intellij.testFramework.junit5.showcase;
|
package com.intellij.testFramework.junit5.showcase;
|
||||||
|
|
||||||
|
import com.intellij.ide.IdeEventQueue;
|
||||||
import com.intellij.testFramework.junit5.RunInEdt;
|
import com.intellij.testFramework.junit5.RunInEdt;
|
||||||
import com.intellij.testFramework.junit5.RunMethodInEdt;
|
import com.intellij.testFramework.junit5.RunMethodInEdt;
|
||||||
import com.intellij.util.ui.EDT;
|
import com.intellij.util.ui.EDT;
|
||||||
@@ -115,23 +116,27 @@ final class JUnit5RunInEdtTest {
|
|||||||
@BeforeAll
|
@BeforeAll
|
||||||
static void beforeAll() {
|
static void beforeAll() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RunMethodInEdt
|
@RunMethodInEdt
|
||||||
MethodLevelAnnotationTest() {
|
MethodLevelAnnotationTest() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RunMethodInEdt
|
@RunMethodInEdt
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void beforeEach() {
|
void beforeEach() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RunMethodInEdt
|
@RunMethodInEdt
|
||||||
@Test
|
@Test
|
||||||
void testMethod() {
|
void testMethod() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -144,6 +149,7 @@ final class JUnit5RunInEdtTest {
|
|||||||
@ExtendWith(EmptyTestTemplateInvocationContextProvider.class)
|
@ExtendWith(EmptyTestTemplateInvocationContextProvider.class)
|
||||||
void testTemplate() {
|
void testTemplate() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RunMethodInEdt
|
@RunMethodInEdt
|
||||||
@@ -152,6 +158,7 @@ final class JUnit5RunInEdtTest {
|
|||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
return List.of(DynamicTest.dynamicTest("dynamic test", () -> {
|
return List.of(DynamicTest.dynamicTest("dynamic test", () -> {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,12 +166,219 @@ final class JUnit5RunInEdtTest {
|
|||||||
@AfterEach
|
@AfterEach
|
||||||
void afterEach() {
|
void afterEach() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RunMethodInEdt
|
@RunMethodInEdt
|
||||||
@AfterAll
|
@AfterAll
|
||||||
static void afterAll() {
|
static void afterAll() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunInEdt(allMethods = false, writeIntent = true) // required to make the extension able to handle lifecycle methods
|
||||||
|
static final class MethodLevelAnnotationTestWithDefaultWriteIntent {
|
||||||
|
|
||||||
|
@RunMethodInEdt
|
||||||
|
@BeforeAll
|
||||||
|
static void beforeAll() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt
|
||||||
|
MethodLevelAnnotationTestWithDefaultWriteIntent() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt
|
||||||
|
@BeforeEach
|
||||||
|
void beforeEach() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt
|
||||||
|
@Test
|
||||||
|
void testMethod() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMethodUnannotated() {
|
||||||
|
Assertions.assertFalse(EDT.isCurrentThreadEdt());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt
|
||||||
|
@TestTemplate
|
||||||
|
@ExtendWith(EmptyTestTemplateInvocationContextProvider.class)
|
||||||
|
void testTemplate() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt
|
||||||
|
@TestFactory
|
||||||
|
List<DynamicTest> testFactory() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
return List.of(DynamicTest.dynamicTest("dynamic test", () -> {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt
|
||||||
|
@AfterEach
|
||||||
|
void afterEach() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt
|
||||||
|
@AfterAll
|
||||||
|
static void afterAll() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunInEdt(allMethods = false) // required to make the extension able to handle lifecycle methods
|
||||||
|
static final class MethodLevelAnnotationTestWithPerMethodWriteIntent {
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.True)
|
||||||
|
@BeforeAll
|
||||||
|
static void beforeAll() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.True)
|
||||||
|
MethodLevelAnnotationTestWithPerMethodWriteIntent() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.True)
|
||||||
|
@BeforeEach
|
||||||
|
void beforeEach() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.True)
|
||||||
|
@Test
|
||||||
|
void testMethod() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMethodUnannotated() {
|
||||||
|
Assertions.assertFalse(EDT.isCurrentThreadEdt());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.True)
|
||||||
|
@TestTemplate
|
||||||
|
@ExtendWith(EmptyTestTemplateInvocationContextProvider.class)
|
||||||
|
void testTemplate() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.True)
|
||||||
|
@TestFactory
|
||||||
|
List<DynamicTest> testFactory() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
return List.of(DynamicTest.dynamicTest("dynamic test", () -> {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.True)
|
||||||
|
@AfterEach
|
||||||
|
void afterEach() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.True)
|
||||||
|
@AfterAll
|
||||||
|
static void afterAll() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RunInEdt(allMethods = false, writeIntent = true) // required to make the extension able to handle lifecycle methods
|
||||||
|
static final class MethodLevelAnnotationTestWithoutPerMethodWriteIntent {
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.False)
|
||||||
|
@BeforeAll
|
||||||
|
static void beforeAll() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.False)
|
||||||
|
MethodLevelAnnotationTestWithoutPerMethodWriteIntent() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.False)
|
||||||
|
@BeforeEach
|
||||||
|
void beforeEach() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.False)
|
||||||
|
@Test
|
||||||
|
void testMethod() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMethodUnannotated() {
|
||||||
|
Assertions.assertFalse(EDT.isCurrentThreadEdt());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.False)
|
||||||
|
@TestTemplate
|
||||||
|
@ExtendWith(EmptyTestTemplateInvocationContextProvider.class)
|
||||||
|
void testTemplate() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.False)
|
||||||
|
@TestFactory
|
||||||
|
List<DynamicTest> testFactory() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
return List.of(DynamicTest.dynamicTest("dynamic test", () -> {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.False)
|
||||||
|
@AfterEach
|
||||||
|
void afterEach() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunMethodInEdt(writeIntent = RunMethodInEdt.WriteIntentMode.False)
|
||||||
|
@AfterAll
|
||||||
|
static void afterAll() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,26 +388,31 @@ final class JUnit5RunInEdtTest {
|
|||||||
@BeforeAll
|
@BeforeAll
|
||||||
static void beforeAll() {
|
static void beforeAll() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassLevelAnnotationTest() {
|
ClassLevelAnnotationTest() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void beforeEach() {
|
void beforeEach() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testMethod() {
|
void testMethod() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
@ExtendWith(EmptyTestTemplateInvocationContextProvider.class)
|
@ExtendWith(EmptyTestTemplateInvocationContextProvider.class)
|
||||||
void testTemplate() {
|
void testTemplate() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestFactory
|
@TestFactory
|
||||||
@@ -201,17 +420,75 @@ final class JUnit5RunInEdtTest {
|
|||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
return List.of(DynamicTest.dynamicTest("dynamic test", () -> {
|
return List.of(DynamicTest.dynamicTest("dynamic test", () -> {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void afterEach() {
|
void afterEach() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
static void afterAll() {
|
static void afterAll() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RunInEdt(writeIntent = true)
|
||||||
|
static final class ClassLevelAnnotationTestWithGlobalWriteIntent {
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
static void beforeAll() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassLevelAnnotationTestWithGlobalWriteIntent() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void beforeEach() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMethod() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestTemplate
|
||||||
|
@ExtendWith(EmptyTestTemplateInvocationContextProvider.class)
|
||||||
|
void testTemplate() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestFactory
|
||||||
|
List<DynamicTest> testFactory() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
return List.of(DynamicTest.dynamicTest("dynamic test", () -> {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterEach
|
||||||
|
void afterEach() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterAll
|
||||||
|
static void afterAll() {
|
||||||
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertTrue(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,6 +501,7 @@ final class JUnit5RunInEdtTest {
|
|||||||
@Test
|
@Test
|
||||||
void testMethod() {
|
void testMethod() {
|
||||||
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
Assertions.assertTrue(EDT.isCurrentThreadEdt());
|
||||||
|
Assertions.assertFalse(IdeEventQueue.getInstance().getRwLockHolder().isWriteIntentLocked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import org.junit.jupiter.params.ParameterizedTest
|
|||||||
import org.junit.jupiter.params.provider.ValueSource
|
import org.junit.jupiter.params.provider.ValueSource
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
@RunInEdt
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
|
@RunInEdt(writeIntent = true)
|
||||||
class EntitiesOrphanageTest {
|
class EntitiesOrphanageTest {
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.Assertions.assertTrue
|
|||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
|
|
||||||
@TestApplication
|
@TestApplication
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
class WorkspaceModelPerformanceTest {
|
class WorkspaceModelPerformanceTest {
|
||||||
companion object {
|
companion object {
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import com.intellij.testFramework.junit5.RunInEdt;
|
|||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
||||||
@RunInEdt
|
@RunInEdt(writeIntent = true)
|
||||||
abstract class JUnit5CodeInsightTest {
|
abstract class JUnit5CodeInsightTest {
|
||||||
protected JavaCodeInsightTestFixture myFixture;
|
protected JavaCodeInsightTestFixture myFixture;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.nio.file.Path
|
|||||||
import javax.swing.JComponent
|
import javax.swing.JComponent
|
||||||
|
|
||||||
@SkipInHeadlessEnvironment
|
@SkipInHeadlessEnvironment
|
||||||
@RunInEdt(allMethods = false)
|
@RunInEdt(allMethods = false, writeIntent = true)
|
||||||
class MarkdownEditorCreationTest {
|
class MarkdownEditorCreationTest {
|
||||||
@TestDisposable
|
@TestDisposable
|
||||||
lateinit var disposable: Disposable
|
lateinit var disposable: Disposable
|
||||||
|
|||||||
Reference in New Issue
Block a user