Add Kotlin port of the logout plugin

This commit is contained in:
Gary Tierney
2017-06-25 02:39:46 +01:00
parent e605241893
commit b2f0c7e4db
3 changed files with 25 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
name = "logout"
@@ -0,0 +1,5 @@
val LOGOUT_BUTTON_ID = 2458
on_button(LOGOUT_BUTTON_ID)
.where { widgetId == LOGOUT_BUTTON_ID }
.then { it.logout() }
@@ -0,0 +1,19 @@
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() {
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))
verify(player, times(1)).logout()
}
}