mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 16:49:12 +00:00
Support npc and object definitions in plugin tests
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user