Implement initial test using MockBukkit.

This commit is contained in:
Jeremy Wood 2023-03-02 02:22:47 -05:00
parent 698d1c7954
commit eebb4a4a6d
No known key found for this signature in database
GPG Key ID: C5BAD04C77B91B4B
2 changed files with 35 additions and 2 deletions

View File

@ -14,7 +14,7 @@ description = 'Multiverse-Core'
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
languageVersion.set(JavaLanguageVersion.of(17))
}
}
@ -92,7 +92,7 @@ dependencies {
// Tests
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10'
testImplementation 'org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT'
testImplementation 'com.github.seeseemelk:MockBukkit-v1.19:2.145.0'
testImplementation('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'junit', module: 'junit'
}

View File

@ -0,0 +1,33 @@
package org.mvplugins.multiverse.core
import be.seeseemelk.mockbukkit.MockBukkit
import com.onarandombox.MultiverseCore.MultiverseCore
import com.onarandombox.MultiverseCore.utils.TestingMode
import org.bukkit.Server
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertNotNull
class MockBukkitTest {
lateinit var server: Server
lateinit var plugin: MultiverseCore
@BeforeTest
fun setUp() {
TestingMode.enable()
server = MockBukkit.mock()
plugin = MockBukkit.load(MultiverseCore::class.java)
}
@Test
fun test() {
assertNotNull(plugin)
}
@AfterTest
fun tearDown() {
MockBukkit.unmock()
}
}