Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Nested
- inner class WhenServerIsRunning {
- private val callBackMessage = callBackMessage(allowedUserMarshall, "Hello", data = "Any")
- @BeforeEach
- fun setup() {
- Mockito.doNothing().`when`(adminService).denyNotPrivilegedAndNotifyAdmin(allowedUserJockey.user, "Hello")
- Mockito.doReturn(true).`when`(consoleService).isServerRunning()
- }
- @AfterEach
- fun resetCalls() {
- Mockito.clearInvocations(bot, adminService, consoleService)
- }
- @Test
- fun `should not start server`() {
- assertThrows<IllegalStateException> {
- botCommandsService.startServer(callBackMessage)
- }
- Mockito.verify(consoleService, Mockito.never()).startServer()
- Mockito.verify(bot, Mockito.times(1)).answerCallbackQuery(
- callbackQueryId = callBackMessage.id,
- showAlert = true,
- text = Messages.serverAlreadyRunning()
- )
- }
- @Test
- fun `should not update server`() {
- assertThrows<IllegalStateException> {
- botCommandsService.updateServer(callBackMessage)
- }
- Mockito.verify(consoleService, Mockito.never()).updateServer()
- Mockito.verify(bot, Mockito.times(1)).answerCallbackQuery(
- callbackQueryId = callBackMessage.id,
- showAlert = true,
- text = Messages.serverAlreadyRunning()
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement