Support npc and object definitions in plugin tests

This commit is contained in:
Major
2018-08-21 00:47:23 +01:00
committed by Major-
parent 71158b3b5e
commit 86fba62ab9
10 changed files with 182 additions and 72 deletions
@@ -13,11 +13,6 @@ import org.junit.jupiter.params.provider.EnumSource
@ExtendWith(ApolloTestingExtension::class)
class AxeTests {
@ItemDefinitions
fun axes() = Axe.values().map {
ItemDefinition(it.id).apply { isStackable = false }
}
@TestMock
lateinit var player: Player
@@ -69,4 +64,11 @@ class AxeTests {
assertEquals(axe, Axe.bestFor(player))
}
private companion object {
@ItemDefinitions
fun axes() = Axe.values().map {
ItemDefinition(it.id).apply { isStackable = false }
}
}
}
@@ -20,19 +20,11 @@ import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.ArgumentsSource
import java.util.*
import java.util.Random
@ExtendWith(ApolloTestingExtension::class)
class WoodcuttingTests {
@ItemDefinitions
fun logs() = woodcuttingTestData().map {
ItemDefinition(it.tree.id).also { it.name = "<tree_type>" }
}
@ItemDefinitions
fun tools() = listOf(ItemDefinition(Axe.BRONZE.id))
@TestMock
lateinit var action: ActionCapture
@@ -85,4 +77,14 @@ class WoodcuttingTests {
assertEquals(1, player.inventory.getAmount(data.tree.id))
}
}
private companion object {
@ItemDefinitions
fun logs() = woodcuttingTestData().map {
ItemDefinition(it.tree.id).also { it.name = "<tree_type>" }
}
@ItemDefinitions
fun tools() = listOf(ItemDefinition(Axe.BRONZE.id))
}
}