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.
* 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.io.FileUtil
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.junit.runner.RunWith
import java.io.File
import java.io.IOException
@RunWith(JUnit3WithIdeaConfigurationRunner.class)
public abstract class KotlinHierarchyViewTestBase extends KotlinLightCodeInsightFixtureTestCase {
private final HierarchyViewTestFixture hierarchyFixture = new HierarchyViewTestFixture();
@RunWith(JUnit3WithIdeaConfigurationRunner::class)
abstract class KotlinHierarchyViewTestBase : KotlinLightCodeInsightFixtureTestCase() {
private val hierarchyFixture = HierarchyViewTestFixture()
protected void doHierarchyTest(
@NotNull Computable<? extends HierarchyTreeStructure> treeStructureComputable,
@NotNull String... fileNames
) throws Exception {
configure(fileNames);
String expectedStructure = loadExpectedStructure();
hierarchyFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure);
@Throws(Exception::class)
protected open fun doHierarchyTest(
treeStructureComputable: Computable<out HierarchyTreeStructure?>,
vararg fileNames: String
) {
configure(fileNames)
val expectedStructure = loadExpectedStructure()
hierarchyFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure)
}
private void configure(@NotNull String[] fileNames) {
myFixture.configureByFiles(fileNames);
private fun configure(fileNames: Array<String>) {
myFixture.configureByFiles(*fileNames)
}
@NotNull
private String loadExpectedStructure() throws IOException {
String verificationFilePath = getTestDataPath() + "/" + getTestName(false) + "_verification.xml";
return FileUtil.loadFile(new File(verificationFilePath));
@Throws(IOException::class)
private fun loadExpectedStructure(): String {
val verificationFilePath = testDataPath + "/" + getTestName(false) + "_verification.xml"
return FileUtil.loadFile(File(verificationFilePath))
}
}
}