mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-06 00:08:04 +01:00
Abstract TestWithMockBukkit out of MockBukkitTest.
This commit is contained in:
parent
00554fefc3
commit
7ad0b04787
@ -1,33 +1,12 @@
|
||||
package org.mvplugins.multiverse.core
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit
|
||||
import be.seeseemelk.mockbukkit.ServerMock
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore
|
||||
import com.onarandombox.MultiverseCore.utils.TestingMode
|
||||
import kotlin.test.AfterTest
|
||||
import kotlin.test.BeforeTest
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
class MockBukkitTest {
|
||||
|
||||
lateinit var server: ServerMock
|
||||
lateinit var plugin: MultiverseCore
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
TestingMode.enable()
|
||||
server = MockBukkit.mock()
|
||||
plugin = MockBukkit.load(MultiverseCore::class.java)
|
||||
}
|
||||
|
||||
@AfterTest
|
||||
fun tearDown() {
|
||||
MockBukkit.unmock()
|
||||
}
|
||||
open class MockBukkitTest : TestWithMockBukkit() {
|
||||
|
||||
@Test
|
||||
fun `MockBukkit loads the plugin`() {
|
||||
assertNotNull(plugin)
|
||||
assertNotNull(multiverseCore)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package org.mvplugins.multiverse.core
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit
|
||||
import be.seeseemelk.mockbukkit.ServerMock
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore
|
||||
import com.onarandombox.MultiverseCore.utils.TestingMode
|
||||
import kotlin.test.AfterTest
|
||||
import kotlin.test.BeforeTest
|
||||
|
||||
/**
|
||||
* Basic abstract test class that sets up MockBukkit and MultiverseCore.
|
||||
*/
|
||||
abstract class TestWithMockBukkit {
|
||||
|
||||
protected lateinit var server: ServerMock
|
||||
protected lateinit var multiverseCore: MultiverseCore
|
||||
|
||||
@BeforeTest
|
||||
fun setUp() {
|
||||
TestingMode.enable()
|
||||
server = MockBukkit.mock()
|
||||
multiverseCore = MockBukkit.load(MultiverseCore::class.java)
|
||||
}
|
||||
|
||||
@AfterTest
|
||||
fun tearDown() {
|
||||
MockBukkit.unmock()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user