Skip to content

Commit 45b81c6

Browse files
anarchuserxeruf
authored andcommitted
test(sdk): ensure that SlotDescriptors get serialised correctly
1 parent 6a4ce35 commit 45b81c6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package sc.shared
2+
3+
import com.thoughtworks.xstream.XStream
4+
import io.kotlintest.specs.StringSpec
5+
import io.kotlintest.inspectors.forAll
6+
import io.kotlintest.shouldBe
7+
8+
class SlotDescriptorTest : StringSpec({
9+
"convert XML" {
10+
val xstream = XStream().apply {
11+
setMode(XStream.NO_REFERENCES)
12+
autodetectAnnotations(true)
13+
}
14+
val descriptors = listOf(
15+
SlotDescriptor(),
16+
SlotDescriptor("Display Name"),
17+
SlotDescriptor("name", false),
18+
SlotDescriptor("another name", true, false)
19+
)
20+
val XMLs = listOf(
21+
"""<slotDescriptor canTimeout="false" shouldBePaused="false"/>""",
22+
"""<slotDescriptor displayName="Display Name" canTimeout="true" shouldBePaused="true"/>""",
23+
"""<slotDescriptor displayName="name" canTimeout="false" shouldBePaused="true"/>""",
24+
"""<slotDescriptor displayName="another name" canTimeout="true" shouldBePaused="false"/>"""
25+
)
26+
27+
(descriptors zip XMLs).forAll {
28+
xstream.toXML(it.first) shouldBe it.second
29+
}
30+
}
31+
})

0 commit comments

Comments
 (0)