mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
[Gradle|Test] cleanup: encapsulate testDisposable in GradleBaseTestCase
GitOrigin-RevId: d7876639d332b4264a8fa9484f0d46c49e63c419
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4839c372ad
commit
5b76401043
@@ -5,19 +5,25 @@ import com.intellij.application.subscribe
|
||||
import com.intellij.ide.trustedProjects.TrustedProjectsListener
|
||||
import com.intellij.ide.trustedProjects.TrustedProjectsLocator
|
||||
import com.intellij.ide.trustedProjects.TrustedProjectsLocator.LocatedProject
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.io.getResolvedPath
|
||||
import org.jetbrains.plugins.gradle.testFramework.GradleTestCase
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import java.nio.file.Path
|
||||
|
||||
abstract class GradleUntrustedProjectTestCase : GradleTestCase() {
|
||||
|
||||
private lateinit var testDisposable: Disposable
|
||||
private lateinit var trustedLocations: List<Path>
|
||||
|
||||
@BeforeEach
|
||||
fun setUpTrustedLocationsWatcher() {
|
||||
fun setUpUntrustedProjectTestCase() {
|
||||
testDisposable = Disposer.newDisposable()
|
||||
|
||||
val trustedLocations = ArrayList<Path>()
|
||||
this.trustedLocations = trustedLocations
|
||||
TrustedProjectsListener.TOPIC.subscribe(testDisposable, object : TrustedProjectsListener {
|
||||
@@ -27,6 +33,11 @@ abstract class GradleUntrustedProjectTestCase : GradleTestCase() {
|
||||
})
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
fun tearDownUntrustedProjectTestCase() {
|
||||
Disposer.dispose(testDisposable)
|
||||
}
|
||||
|
||||
fun assertTrustedLocations(vararg relativePaths: String) {
|
||||
assertTrustedLocations(relativePaths.toList())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user