import com.google.common.base.Optional.of
import net.pterodactylus.sone.core.Core
import net.pterodactylus.sone.data.Post
-import net.pterodactylus.sone.freenet.fcp.FcpException
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
import org.hamcrest.MatcherAssert.assertThat
fun `request without text results in fcp exception`() {
parameters.putSingle("Sone", "LocalSoneId")
whenever(core.getSone("LocalSoneId")).thenReturn(Optional.of(localSone))
- expectedException.expect(FcpException::class.java)
- command.execute(parameters, null, null)
+ executeCommandAndExpectFcpException()
}
@Test
parameters.putSingle("Text", "Test")
parameters.putSingle("Recipient", "InvalidSoneId")
whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone))
- expectedException.expect(FcpException::class.java)
- command.execute(parameters, null, null)
+ executeCommandAndExpectFcpException()
}
@Test