mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
testFramework [platform]: Cleanup RegistryKeyAppLevel
GitOrigin-RevId: 9bb2ae4238e3ddc0fec29ce572d2ae87cd6a63b1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fc28fc9dcf
commit
f32fa80a8f
@@ -5,8 +5,8 @@ import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.util.registry.RegistryValue
|
||||
import com.intellij.testFramework.junit5.RegistryKey
|
||||
import com.intellij.testFramework.junit5.RegistryKeyAppLevel
|
||||
import com.intellij.testFramework.junit5.impl.TypedStoreKey.Companion.getTyped
|
||||
import com.intellij.testFramework.junit5.impl.TypedStoreKey.Companion.putTyped
|
||||
import com.intellij.testFramework.junit5.impl.TypedStoreKey.Companion.get
|
||||
import com.intellij.testFramework.junit5.impl.TypedStoreKey.Companion.set
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import org.junit.jupiter.api.extension.AfterAllCallback
|
||||
import org.junit.jupiter.api.extension.BeforeAllCallback
|
||||
@@ -27,13 +27,13 @@ internal class RegistryKeyExtension : AbstractInvocationInterceptor(), BeforeAll
|
||||
if (annotation != null) {
|
||||
val registryValue = Registry.get(annotation.key)
|
||||
val oldValue = registryValue.asString()
|
||||
context.getStore(ExtensionContext.Namespace.GLOBAL).putTyped(typedKey, RegistryValueHolder(registryValue, oldValue))
|
||||
context[typedKey] = RegistryValueHolder(registryValue, oldValue)
|
||||
registryValue.setValue(annotation.value)
|
||||
}
|
||||
}
|
||||
|
||||
override fun afterAll(context: ExtensionContext) {
|
||||
val regValue = context.getStore(ExtensionContext.Namespace.GLOBAL).getTyped(typedKey) ?: return
|
||||
val regValue = context[typedKey] ?: return
|
||||
regValue.value.setValue(regValue.oldValue)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user