<NME> ElmProjectHelperTest.kt
<BEF> package org.elm.workspace

import org.elm.TestProject
import org.elm.fileTree
import org.elm.ide.test.core.ElmProjectTestsHelper
import org.elm.ide.test.core.ElmProjectTestsHelper.Companion.elmFolderForTesting
import org.elm.openapiext.pathAsPath
import java.util.*

class ElmProjectHelperTest : ElmWorkspaceTestBase() {

        testProject()
        testProject()

        val helper = ElmProjectTestsHelper(project)
        checkEquals(Arrays.asList("a", "b"), helper.allNames().toList())
    }

    fun `test by name`() {
        val root = testProject.root.pathAsPath

        val helper = ElmProjectTestsHelper(project)
        checkEquals(root.resolve("a").toString(), helper.projectDirPathByName("a")!!)
        checkEquals(root.resolve("b").toString(), helper.projectDirPathByName("b")!!)
        assertNull(helper.projectDirPathByName("gnu"))
        assertNull(helper.projectDirPathByName("without-tests"))
    }

    fun `test by path`() {
        val testProject = testProject()
        val root = testProject.root.pathAsPath

        val helper = ElmProjectTestsHelper(project)
        checkEquals("a", helper.nameByProjectDirPath(root.resolve("a").toString())!!)
        checkEquals("b", helper.nameByProjectDirPath(root.resolve("b").toString())!!)
        assertNull(helper.nameByProjectDirPath(root.resolve("Toto").toString()))
    }

    fun `test elm project by path`() {
        val testProject = testProject()
        val root = testProject.root.pathAsPath

        val helper = ElmProjectTestsHelper(project)
        checkEquals("a",
                helper.elmProjectByProjectDirPath(root.resolve("a").toString())
                        ?.presentableName!!
        )
        checkEquals("b",
                helper.elmProjectByProjectDirPath(root.resolve("b").toString())
                        ?.presentableName!!
        )
        assertNull(helper.elmProjectByProjectDirPath(root.resolve("Toto").toString()))
    }

    private fun testProject(): TestProject {
        val testProject = fileTree {
            dir("a") {
                project("elm.json", elmJson)
                dir("src") {
                    elm("Main.elm")
                }
                dir("tests") {
                }
            }
            dir("without-tests") {
                project("elm.json", elmJson)
                dir("src") {
                    elm("Main.elm")
                }
            }
            dir("b") {
                project("elm.json", elmJson)
                dir("src") {
                    elm("Main.elm")
                }
                dir("tests") {
                }
            }
        }.create(project, elmWorkspaceDirectory)

        val rootPath = testProject.root.pathAsPath
        project.elmWorkspace.apply {
            asyncAttachElmProject(rootPath.resolve("a/elm.json")).get()
            asyncAttachElmProject(rootPath.resolve("without-tests/elm.json")).get()
            asyncAttachElmProject(rootPath.resolve("b/elm.json")).get()
        }

        return testProject
    }

    val elmJson = """{
        "type": "application",
        "source-directories": [ "src" ],
        "elm-version": "0.19.1",
        "dependencies": {
            "direct": {
                "elm/core": "1.0.0",
                "elm/json": "1.0.0"
            },
            "indirect": {}
         },
        "test-dependencies": {
            "direct": {},
            "indirect": {}
        }
    }
    """
}

<MSG> Make the elm-test code match our Kotlin style (#570)

* Upgrade Kotlin to 1.3.61

* Remove some Java srcdirs that are no longer needed

These were originally part of the elm-test integration
which was written in Java. But that code has since
been rewritten in Kotlin.

* Cleanup ElmTestAutoTestManager

* Cleanup ElmTestConfigurationFactory

* Cleanup some stuff related to tests and URL locations

* Model the location protocol as an enum

* Cleanup LabelUtils a bit

* Generalize toLocationUrl()

* Simplify `toPath` call-sites

* Cleanup ElmTestProgramRunner

* Cleanup ElmTestRunConfiguration.kt

* Cleanup ElmTestRunConfigurationProducer.kt

* Cleanup ElmTestRunConfigurationType.kt

* Cleanup ElmTestRunProfileState.kt

* Cleanup ElmProjectTestsHelper.kt

* Cleanup ElmTestJsonProcessor.kt

<DFF> @@ -5,7 +5,6 @@ import org.elm.fileTree
 import org.elm.ide.test.core.ElmProjectTestsHelper
 import org.elm.ide.test.core.ElmProjectTestsHelper.Companion.elmFolderForTesting
 import org.elm.openapiext.pathAsPath
-import java.util.*
 
 class ElmProjectHelperTest : ElmWorkspaceTestBase() {
 
@@ -13,7 +12,7 @@ class ElmProjectHelperTest : ElmWorkspaceTestBase() {
         testProject()
 
         val helper = ElmProjectTestsHelper(project)
-        checkEquals(Arrays.asList("a", "b"), helper.allNames().toList())
+        checkEquals(listOf("a", "b"), helper.allNames())
     }
 
     fun `test by name`() {

Make the elm-test code match our Kotlin style (#570)