+ @Test
+ fun `executing command with single non-numeric parameter will not fetch anything`() {
+ command.execute(state, listOf("a"), StringWriter())
+ verify(core, never()).fetch(any(), any())
+ }
+
+ @Test
+ fun `executing command with single non-numeric parameter will return old state`() {
+ val newState = command.execute(state, listOf("a"), StringWriter())
+ assertThat(newState, equalTo(state))
+ }
+
+ @Test
+ fun `executing command with single numeric parameter but no last results will not fetch anything`() {
+ command.execute(state, listOf("0"), StringWriter())
+ verify(core, never()).fetch(any(), any())
+ }
+
+ @Test
+ fun `executing command with single numeric parameter but no last results will return old state`() {
+ val newState = command.execute(state, listOf("0"), StringWriter())
+ assertThat(newState, equalTo(state))
+ }
+
+ @Test
+ fun `executing command with single numeric parameter and last results will fetch correct pack from correct bot`() {
+ val bot = mock(Bot::class.java)
+ val pack = Pack("1", "2", "3")
+ val state = state.setLastResults(listOf(Result(core, bot, pack)))
+ command.execute(state, listOf("0"), StringWriter())
+ verify(core).fetch(bot, pack)
+ }
+
+ @Test
+ fun `executing command with single numeric parameter and last results will return old state`() {
+ val bot = mock(Bot::class.java)
+ val pack = Pack("1", "2", "3")
+ val state = state.setLastResults(listOf(Result(core, bot, pack)))
+ val newState = command.execute(state, listOf("1"), StringWriter())
+ assertThat(newState, equalTo(state))
+ }
+