package net.pterodactylus.sone.fcp
import net.pterodactylus.sone.core.Core
-import net.pterodactylus.sone.data.Profile
-import net.pterodactylus.sone.data.Sone
-import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
assertThat(command.requiresWriteAccess(), equalTo(false))
}
- private fun createSone(id: String, name: String, firstName: String, lastName: String, time: Long) = mock<Sone>().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)
- }
-
@Test
fun `command returns local sones`() {
val localSones = setOf(
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
whenever(core.getPostReply(anyString())).thenReturn(absent())
}
+ protected fun createSone(id: String, name: String, firstName: String, lastName: String, time: Long) = mock<Sone>().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)