X-Git-Url: https://git.pterodactylus.net/?p=xudocci.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fxdcc%2Fui%2Fstdin%2FDownloadCommandTest.kt;fp=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fxdcc%2Fui%2Fstdin%2FDownloadCommandTest.kt;h=2d3aa0ac5c1d09ae990f8ac9697cc2320df5da7e;hp=0000000000000000000000000000000000000000;hb=8f3dfaa25a9ae48ed5bc836684d8dce7a4bf452b;hpb=46b4f2373ccda79ba837c86f4decbda1229a97d0 diff --git a/src/test/java/net/pterodactylus/xdcc/ui/stdin/DownloadCommandTest.kt b/src/test/java/net/pterodactylus/xdcc/ui/stdin/DownloadCommandTest.kt new file mode 100644 index 0000000..2d3aa0a --- /dev/null +++ b/src/test/java/net/pterodactylus/xdcc/ui/stdin/DownloadCommandTest.kt @@ -0,0 +1,31 @@ +package net.pterodactylus.xdcc.ui.stdin + +import net.pterodactylus.xdcc.core.Core +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.equalTo +import org.mockito.Matchers.any +import org.mockito.Mockito +import org.mockito.Mockito.never +import org.mockito.Mockito.verify +import java.io.StringWriter +import kotlin.test.Test + +class DownloadCommandTest { + + private val core = Mockito.mock(Core::class.java) + private val command = DownloadCommand(core) + private val state = State() + + @Test + fun `executing command without parameters will not fetch anything`() { + command.execute(state, emptyList(), StringWriter()) + verify(core, never()).fetch(any(), any()) + } + + @Test + fun `executing command without parameters will return old state`() { + val newState = command.execute(state, emptyList(), StringWriter()) + assertThat(newState, equalTo(state)) + } + +}