1
1
package sc.shared
2
2
3
3
import com.thoughtworks.xstream.XStream
4
+ import io.kotlintest.data.forall
4
5
import io.kotlintest.specs.StringSpec
5
6
import io.kotlintest.inspectors.forAll
6
7
import io.kotlintest.shouldBe
8
+ import io.kotlintest.tables.row
7
9
8
10
class SlotDescriptorTest : StringSpec ({
9
11
" convert XML" {
10
12
val xstream = XStream ().apply {
11
13
setMode(XStream .NO_REFERENCES )
12
14
autodetectAnnotations(true)
13
15
}
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"/>""") ,
17
19
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"/>""") ,
20
22
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"/>""") ,
23
25
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"/>""")
26
28
)
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()
31
32
}
32
33
}
33
34
})
0 commit comments