2
0

CoreShadowRelocationTest.kt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2019-2022 Mamoe Technologies and contributors.
  3. *
  4. * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
  5. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
  6. *
  7. * https://github.com/mamoe/mirai/blob/dev/LICENSE
  8. */
  9. package net.mamoe.mirai.deps.test
  10. import org.junit.jupiter.api.Test
  11. import org.junit.jupiter.api.condition.EnabledIf
  12. class CoreShadowRelocationTest : AbstractTest() {
  13. @Test
  14. @EnabledIf("isMiraiLocalAvailable", disabledReason = REASON_LOCAL_ARTIFACT_NOT_AVAILABLE)
  15. fun `test OkHttp filtered out`() {
  16. testDir.resolve("test.kt").writeText(
  17. """
  18. package test
  19. import org.junit.jupiter.api.*
  20. class MyTest {
  21. @Test
  22. fun `test base dependency`() {
  23. assertThrows<ClassNotFoundException> {
  24. Class.forName("io.ktor.client.engine.okhttp.OkHttp")
  25. }
  26. }
  27. @Test
  28. fun `test transitive dependency`() {
  29. assertThrows<ClassNotFoundException> {
  30. Class.forName("okhttp3.OkHttpClient")
  31. }
  32. }
  33. }
  34. """.trimIndent()
  35. )
  36. buildFile.appendText(
  37. """
  38. dependencies {
  39. implementation("net.mamoe:mirai-core:$miraiLocalVersion")
  40. }
  41. """.trimIndent()
  42. )
  43. runGradle("check")
  44. }
  45. }