11package sc.shared
22
33import com.thoughtworks.xstream.XStream
4+ import io.kotlintest.data.forall
45import io.kotlintest.specs.StringSpec
56import io.kotlintest.inspectors.forAll
67import io.kotlintest.shouldBe
8+ import io.kotlintest.tables.row
79
810class SlotDescriptorTest : StringSpec ({
911 " convert XML" {
1012 val xstream = XStream ().apply {
1113 setMode(XStream .NO_REFERENCES )
1214 autodetectAnnotations(true)
1315 }
14- val descriptors = listOf (
15- SlotDescriptor () to
16- """<slotDescriptor displayName="Unknown " canTimeout="true" shouldBePaused="true"/>""",
16+ forall (
17+ row( SlotDescriptor (),
18+ """<slotDescriptor displayName="Unknown " canTimeout="true" shouldBePaused="true"/>""") ,
1719
18- SlotDescriptor ("Display Name ") to
19- """<slotDescriptor displayName="Display Name " canTimeout="true" shouldBePaused="true"/>""",
20+ row( SlotDescriptor ("Display Name "),
21+ """<slotDescriptor displayName="Display Name " canTimeout="true" shouldBePaused="true"/>""") ,
2022
21- SlotDescriptor ("name", false) to
22- """<slotDescriptor displayName="name" canTimeout="false" shouldBePaused="true"/>""",
23+ row( SlotDescriptor ("name", false),
24+ """<slotDescriptor displayName="name" canTimeout="false" shouldBePaused="true"/>""") ,
2325
24- SlotDescriptor ("another name", true, false) to
25- """<slotDescriptor displayName="another name" canTimeout="true" shouldBePaused="false"/>"""
26+ row( SlotDescriptor ("another name", true, false),
27+ """<slotDescriptor displayName="another name" canTimeout="true" shouldBePaused="false"/>""")
2628 )
27-
28- descriptors.forAll {
29- xstream.toXML(it.first) shouldBe it.second
30- xstream.fromXML(it.second).toString() shouldBe it.first.toString()
29+ { descriptor, xml ->
30+ xstream.toXML(descriptor) shouldBe xml
31+ xstream.fromXML(xml).toString() shouldBe descriptor.toString()
3132 }
3233 }
3334})
0 commit comments