AbstractConsoleTest.kt 993 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright 2019-2021 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/master/LICENSE
  8. */
  9. package net.mamoe.mirai.console
  10. import kotlinx.coroutines.cancelAndJoin
  11. import kotlinx.coroutines.runBlocking
  12. import net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription
  13. import net.mamoe.mirai.console.plugin.jvm.KotlinPlugin
  14. import org.junit.jupiter.api.AfterEach
  15. import org.junit.jupiter.api.BeforeEach
  16. abstract class AbstractConsoleTest {
  17. val mockPlugin = object : KotlinPlugin(JvmPluginDescription("org.test.test", "1.0.0")) {}
  18. @BeforeEach
  19. fun beforeTest() {
  20. initTestEnvironment()
  21. }
  22. @AfterEach
  23. fun afterTest() {
  24. runBlocking { MiraiConsole.job.cancelAndJoin() }
  25. }
  26. }