2023-03-07 07:59:48 +01:00
|
|
|
package org.mvplugins.multiverse.core.inject
|
|
|
|
|
|
|
|
import org.mvplugins.multiverse.core.TestWithMockBukkit
|
2023-09-11 18:56:20 +02:00
|
|
|
import org.mvplugins.multiverse.core.anchor.AnchorManager
|
|
|
|
import org.mvplugins.multiverse.core.api.BlockSafety
|
|
|
|
import org.mvplugins.multiverse.core.api.Destination
|
|
|
|
import org.mvplugins.multiverse.core.api.LocationManipulation
|
|
|
|
import org.mvplugins.multiverse.core.api.SafeTTeleporter
|
|
|
|
import org.mvplugins.multiverse.core.commandtools.MVCommandManager
|
|
|
|
import org.mvplugins.multiverse.core.commandtools.MultiverseCommand
|
|
|
|
import org.mvplugins.multiverse.core.commandtools.PluginLocales
|
|
|
|
import org.mvplugins.multiverse.core.config.MVCoreConfig
|
|
|
|
import org.mvplugins.multiverse.core.economy.MVEconomist
|
|
|
|
import org.mvplugins.multiverse.core.listeners.*
|
|
|
|
import org.mvplugins.multiverse.core.teleportation.SimpleBlockSafety
|
|
|
|
import org.mvplugins.multiverse.core.teleportation.SimpleLocationManipulation
|
|
|
|
import org.mvplugins.multiverse.core.teleportation.SimpleSafeTTeleporter
|
|
|
|
import org.mvplugins.multiverse.core.teleportation.TeleportQueue
|
|
|
|
import org.mvplugins.multiverse.core.utils.metrics.MetricsConfigurator
|
2023-09-12 17:05:51 +02:00
|
|
|
import org.mvplugins.multiverse.core.world.WorldManager
|
2023-09-11 18:41:17 +02:00
|
|
|
import kotlin.test.*
|
2023-03-07 07:59:48 +01:00
|
|
|
|
|
|
|
class InjectionTest : TestWithMockBukkit() {
|
|
|
|
|
2023-03-07 20:39:11 +01:00
|
|
|
@Test
|
|
|
|
fun `AnchorManager is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(AnchorManager::class.java))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `BlockSafety is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(BlockSafety::class.java))
|
|
|
|
assertNotNull(multiverseCore.getService(SimpleBlockSafety::class.java))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `MVCommandManager is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(MVCommandManager::class.java))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `MVEconomist is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(MVEconomist::class.java))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `LocationManipulation is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(LocationManipulation::class.java))
|
|
|
|
assertNotNull(multiverseCore.getService(SimpleLocationManipulation::class.java))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `SafeTTeleporter is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(SafeTTeleporter::class.java))
|
|
|
|
assertNotNull(multiverseCore.getService(SimpleSafeTTeleporter::class.java))
|
|
|
|
}
|
|
|
|
|
2023-03-28 05:32:04 +02:00
|
|
|
@Test
|
|
|
|
fun `TeleportQueue is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(TeleportQueue::class.java))
|
|
|
|
}
|
|
|
|
|
2023-03-07 20:39:11 +01:00
|
|
|
@Test
|
|
|
|
fun `MVWorldManager is available as a service`() {
|
2023-09-04 04:34:32 +02:00
|
|
|
assertNotNull(multiverseCore.getService(WorldManager::class.java))
|
2023-03-07 20:39:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `MVEntityListener is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(MVEntityListener::class.java))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `MVPlayerListener is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(MVPlayerListener::class.java))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `MVChatListener is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(MVChatListener::class.java))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `MVPortalListener is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(MVPortalListener::class.java))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `MVWeatherListener is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(MVWeatherListener::class.java))
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `MVWorldListener is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(MVWorldListener::class.java))
|
|
|
|
}
|
|
|
|
|
2023-03-07 22:10:34 +01:00
|
|
|
@Test
|
2023-03-27 06:25:13 +02:00
|
|
|
fun `MVCoreConfig is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(MVCoreConfig::class.java))
|
2023-03-07 22:10:34 +01:00
|
|
|
}
|
2023-03-08 14:43:40 +01:00
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `Commands are available as services`() {
|
|
|
|
val commands = multiverseCore.getAllServices(MultiverseCommand::class.java)
|
2023-09-01 17:39:36 +02:00
|
|
|
// TODO: come up with a better way to test this like via actually testing the effect of calling each command
|
|
|
|
// TODO: comment this until all commands are done
|
|
|
|
// assertEquals(18, commands.size)
|
2023-03-08 14:43:40 +01:00
|
|
|
}
|
2023-03-08 19:16:18 +01:00
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `Destinations are available as services`() {
|
|
|
|
val destinations = multiverseCore.getAllServices(Destination::class.java)
|
2023-09-02 08:50:10 +02:00
|
|
|
// TODO: come up with a better way to test this like via actually testing the effect of using each destination
|
2023-03-08 19:16:18 +01:00
|
|
|
assertEquals(6, destinations.size)
|
|
|
|
}
|
2023-03-11 17:24:24 +01:00
|
|
|
|
2023-03-26 19:33:01 +02:00
|
|
|
@Test
|
|
|
|
fun `MetricsConfigurator is not available as a service`() {
|
|
|
|
// Also making sure this is not loaded automatically since it's supposed to be disabled during tests
|
|
|
|
assertNull(multiverseCore.getService(MetricsConfigurator::class.java))
|
|
|
|
}
|
2023-03-29 06:51:54 +02:00
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `PluginLocales is available as a service`() {
|
|
|
|
assertNotNull(multiverseCore.getService(PluginLocales::class.java))
|
|
|
|
}
|
2023-03-07 07:59:48 +01:00
|
|
|
}
|