201: Convert KotlinHierarchyViewTestBase.java because of typealiases

This commit is contained in:
Nikolay Krasko
2020-01-28 21:55:19 +03:00
committed by Nikolay Krasko
parent 6bd91ec5b0
commit 5e58a66c58
@@ -2,38 +2,39 @@
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
package org.jetbrains.kotlin.idea
package org.jetbrains.kotlin.idea; import com.intellij.ide.hierarchy.HierarchyTreeStructure
import com.intellij.openapi.util.Computable import com.intellij.openapi.util.Computable
import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.io.FileUtil
import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestFixture import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestFixture
import org.jetbrains.annotations.NotNull import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
import org.junit.runner.RunWith import org.junit.runner.RunWith
import java.io.File
import java.io.IOException import java.io.IOException
@RunWith(JUnit3WithIdeaConfigurationRunner.class) @RunWith(JUnit3WithIdeaConfigurationRunner::class)
public abstract class KotlinHierarchyViewTestBase extends KotlinLightCodeInsightFixtureTestCase { abstract class KotlinHierarchyViewTestBase : KotlinLightCodeInsightFixtureTestCase() {
private final HierarchyViewTestFixture hierarchyFixture = new HierarchyViewTestFixture(); private val hierarchyFixture = HierarchyViewTestFixture()
protected void doHierarchyTest( @Throws(Exception::class)
@NotNull Computable<? extends HierarchyTreeStructure> treeStructureComputable, protected open fun doHierarchyTest(
@NotNull String... fileNames treeStructureComputable: Computable<out HierarchyTreeStructure?>,
) throws Exception { vararg fileNames: String
configure(fileNames); ) {
String expectedStructure = loadExpectedStructure(); configure(fileNames)
val expectedStructure = loadExpectedStructure()
hierarchyFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure); hierarchyFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure)
} }
private void configure(@NotNull String[] fileNames) { private fun configure(fileNames: Array<String>) {
myFixture.configureByFiles(fileNames); myFixture.configureByFiles(*fileNames)
} }
@NotNull @Throws(IOException::class)
private String loadExpectedStructure() throws IOException { private fun loadExpectedStructure(): String {
String verificationFilePath = getTestDataPath() + "/" + getTestName(false) + "_verification.xml"; val verificationFilePath = testDataPath + "/" + getTestName(false) + "_verification.xml"
return FileUtil.loadFile(new File(verificationFilePath)); return FileUtil.loadFile(File(verificationFilePath))
} }
} }