It's a plugin for a Spigot Minecraft server to log the time players spend on the server and returns it to them.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.0 KiB

package listener
import PlayerService
import io.mockk.Runs
import io.mockk.confirmVerified
import io.mockk.every
import io.mockk.just
import io.mockk.mockk
import io.mockk.verify
import java.util.UUID
import org.bukkit.entity.Player
import org.bukkit.event.player.PlayerJoinEvent
import org.junit.jupiter.api.Test
class JoinListenerTest {
fun `should call to add a player`() {
val mockPlayer = mockk<Player>()
every { mockPlayer.uniqueId } returns UUID.randomUUID()
every { } returns ""
val mockPlayerJoinEvent = mockk<PlayerJoinEvent>()
every { mockPlayerJoinEvent.player } returns mockPlayer
val mockPlayerService = mockk<PlayerService>()
every { mockPlayerService.addPlayer(any(), any()) } just Runs
val joinListener = JoinListener(mockPlayerService)
verify(exactly = 1) { mockPlayerService.addPlayer(any(), any()) }