From 5e58a66c586377ade71f84805668c3bb05661a2b Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 28 Jan 2020 21:55:19 +0300 Subject: [PATCH] 201: Convert KotlinHierarchyViewTestBase.java because of typealiases --- .../idea/KotlinHierarchyViewTestBase.kt | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/idea/tests/org/jetbrains/kotlin/idea/KotlinHierarchyViewTestBase.kt b/idea/tests/org/jetbrains/kotlin/idea/KotlinHierarchyViewTestBase.kt index 1b7c6d4c8cc..7489e8100b2 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/KotlinHierarchyViewTestBase.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/KotlinHierarchyViewTestBase.kt @@ -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 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, + 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) { + 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)) } -} +} \ No newline at end of file