mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-05 08:40:08 +00:00
Update plugin test framework to junit5
Updates the testing infrastructure to use the latest relesae of junit and leverages the new extension mechanism to create an easy to use testing framework. Also adds additional test coverage for several plugins.
This commit is contained in:
@@ -1,19 +1,27 @@
|
||||
import org.apollo.game.message.impl.ButtonMessage
|
||||
import org.apollo.game.plugin.testing.KotlinPluginTest
|
||||
import org.junit.Test
|
||||
import org.mockito.Mockito.times
|
||||
import org.mockito.Mockito.verify
|
||||
|
||||
class LogoutTests : KotlinPluginTest() {
|
||||
import io.mockk.verify
|
||||
import org.apollo.game.message.impl.ButtonMessage
|
||||
import org.apollo.game.model.entity.Player
|
||||
import org.apollo.game.plugin.testing.junit.ApolloTestingExtension
|
||||
import org.apollo.game.plugin.testing.junit.api.annotations.TestMock
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.extension.ExtendWith
|
||||
|
||||
@ExtendWith(ApolloTestingExtension::class)
|
||||
class LogoutTests {
|
||||
|
||||
companion object {
|
||||
const val LOGOUT_BUTTON_ID = 2458
|
||||
}
|
||||
|
||||
@Test fun `The player should be logged out when they click the logout button`() {
|
||||
player.notify(ButtonMessage(LOGOUT_BUTTON_ID))
|
||||
@TestMock
|
||||
lateinit var player: Player
|
||||
|
||||
verify(player, times(1)).logout()
|
||||
@Test
|
||||
fun `The player should be logged out when they click the logout button`() {
|
||||
player.send(ButtonMessage(LOGOUT_BUTTON_ID))
|
||||
|
||||
verify { player.logout() }
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user