}
protected fun requestWithEmptySoneParameterResultsInFcpException() {
- parameters.putSingle("Sone", null)
+ parameters += "Sone" to null
executeCommandAndExpectFcpException()
}
protected fun requestWithInvalidSoneParameterResultsInFcpException() {
- parameters.putSingle("Sone", "InvalidSoneId")
+ parameters += "Sone" to "InvalidSoneId"
executeCommandAndExpectFcpException()
}
fun requestWithValidRemoteSoneParameterResultsInFcpException() {
- parameters.putSingle("Sone", "RemoteSoneId")
+ parameters += "Sone" to "RemoteSoneId"
whenever(core.getSone("RemoteSoneId")).thenReturn(Optional.of(remoteSone))
executeCommandAndExpectFcpException()
}
+ protected operator fun SimpleFieldSet.plusAssign(keyValue: Pair<String, String?>) = putSingle(keyValue.first, keyValue.second)
protected fun SimpleFieldSet.parsePost(prefix: String) = parseFromSimpleFieldSet(prefix, "ID", "Sone", "Recipient", "Time", "Text")
protected fun SimpleFieldSet.parseReply(prefix: String) = parseFromSimpleFieldSet(prefix, "ID", "Sone", "Time", "Text")
expect("Sone", post.sone.id) { it["Sone"] }
expect("recipient", post.recipientId.orNull()) { it["Recipient"] }
expect("time", post.time.toString()) { it["Time"] }
- expect("text", post.text) { it["Text"] }
+ expect("text", post.text.replace("\\", "\\\\").replace("\r", "\\r").replace("\n", "\\n")) { it["Text"] }
}
protected fun matchesReply(reply: PostReply) = OneByOneMatcher<Map<String, String?>>().apply {
expect("ID", reply.id) { it["ID"] }
expect("Sone", reply.sone.id) { it["Sone"] }
expect("time", reply.time.toString()) { it["Time"] }
- expect("text", reply.text) { it["Text"] }
+ expect("text", reply.text.replace("\\", "\\\\").replace("\r", "\\r").replace("\n", "\\n")) { it["Text"] }
}
}