X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FSoneCommandTest.kt;h=8344531b587a6f4320083f96bff69b57293fde4f;hp=f34b19cd66057c7f018daef0e62b954c994552ac;hb=5684bc4813ffdbe26af73cb3cf6a1f62abbadedb;hpb=eb1602e49345ba9fb42e4c1758651543cb1c45b9 diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt index f34b19c..8344531 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt @@ -4,6 +4,7 @@ import com.google.common.base.Optional import com.google.common.base.Optional.absent import freenet.support.SimpleFieldSet import net.pterodactylus.sone.core.Core +import net.pterodactylus.sone.data.Profile import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.freenet.fcp.FcpException import net.pterodactylus.sone.test.mock @@ -38,6 +39,16 @@ abstract class SoneCommandTest { whenever(core.getPostReply(anyString())).thenReturn(absent()) } + protected fun createSone(id: String, name: String, firstName: String, lastName: String, time: Long) = mock().apply { + whenever(this.id).thenReturn(id) + whenever(this.name).thenReturn(name) + whenever(profile).thenReturn(Profile(this).apply { + this.firstName = firstName + this.lastName = lastName + }) + whenever(this.time).thenReturn(time) + } + protected fun executeCommandAndExpectFcpException() { expectedException.expect(FcpException::class.java) command.execute(parameters)