forked from fwcd/kotlin-language-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClassPathTest.kt
47 lines (36 loc) · 1.39 KB
/
ClassPathTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package org.javacs.kt
import org.hamcrest.Matchers.*
import org.javacs.kt.classpath.*
import org.junit.Assert.assertThat
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.BeforeClass
import java.nio.file.Files
class ClassPathTest {
companion object {
@JvmStatic @BeforeClass fun setupLogger() {
LOG.connectStdioBackend()
}
}
@Test fun `find gradle classpath`() {
val workspaceRoot = testResourcesRoot().resolve("additionalWorkspace")
val buildFile = workspaceRoot.resolve("build.gradle")
assertTrue(Files.exists(buildFile))
val resolvers = defaultClassPathResolver(listOf(workspaceRoot))
print(resolvers)
val classPath = resolvers.classpathOrEmpty.map { it.toString() }
assertThat(classPath, hasItem(containsString("junit")))
}
@Test fun `find maven classpath`() {
val workspaceRoot = testResourcesRoot().resolve("mavenWorkspace")
val buildFile = workspaceRoot.resolve("pom.xml")
assertTrue(Files.exists(buildFile))
val resolvers = defaultClassPathResolver(listOf(workspaceRoot))
print(resolvers)
val classPath = resolvers.classpathOrEmpty.map { it.toString() }
assertThat(classPath, hasItem(containsString("junit")))
}
@Test fun `find kotlin stdlib`() {
assertThat(findKotlinStdlib(), notNullValue())
}
}