X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FSoneCommandTest.kt;h=e5c2066df992b5c64d3c3b397528972473904130;hp=ddaecee68bace977d4e3a3e238f216a073ce6a0f;hb=18423dd893c8d4f1ef7d3a82ae229f5544b7616e;hpb=284a781c6d0539232763ea572854d44a62241863 diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt index ddaecee..e5c2066 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/SoneCommandTest.kt @@ -99,7 +99,7 @@ abstract class SoneCommandTest { protected operator fun SimpleFieldSet.plusAssign(keyValue: Pair) = 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") - protected fun SimpleFieldSet.parseSone(prefix: String) = parseFromSimpleFieldSet(prefix, "Name", "NiceName", "LastUpdated", "Followed") + + protected fun SimpleFieldSet.parseSone(prefix: String) = parseFromSimpleFieldSet(prefix, "ID", "Name", "NiceName", "LastUpdated", "Followed") + (0 until this["${prefix}Field.Count"].toInt()).map { ("Field." + this["${prefix}Field.$it.Name"]) to this["${prefix}Field.$it.Value"] } @@ -124,6 +124,7 @@ abstract class SoneCommandTest { } protected fun matchesSone(sone: Sone) = OneByOneMatcher>().apply { + expect("ID", sone.id) { it["ID"] } expect("name", sone.name) { it["Name"] } expect("last updated", sone.time.toString()) { it["LastUpdated"] } expect("nice name", SoneAccessor.getNiceName(sone)) { it["NiceName"] }