Skip to content

Commit eb0c708

Browse files
committed
Simplified tests using "expect" blocks
1 parent e9fed69 commit eb0c708

File tree

3 files changed

+12
-30
lines changed

3 files changed

+12
-30
lines changed

src/test/groovy/com/github/magneticflux/rss/namespaces/standard/elements/CategoryTest.groovy

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@ class CategoryTest extends PersisterSpecification {
88
@Unroll
99
def 'category #object read/write'() {
1010

11-
when: 'the object is written to XML'
12-
def output = persister.write(object)
11+
expect: 'the output XML equals the given XML'
12+
persister.write(object) == xml
1313

14-
then: 'the output XML equals the given XML'
15-
output == xml
16-
17-
when: 'the XML is read to an object'
18-
def input = persister.read(Category, xml)
19-
20-
then: 'the input object equals the given object'
21-
input == object
14+
and: 'the input object equals the given object'
15+
persister.read(Category, xml) == object
2216

2317
where:
2418
domain | text | xml

src/test/groovy/com/github/magneticflux/rss/namespaces/standard/elements/CloudTest.groovy

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,11 @@ class CloudTest extends PersisterSpecification {
77
@Unroll
88
def 'cloud #object read/write'() {
99

10-
when: 'the object is written to XML'
11-
def output = persister.write(object)
10+
expect: 'the output XML equals the given XML'
11+
persister.write(object) == xml
1212

13-
then: 'the output XML equals the given XML'
14-
output == xml
15-
16-
when: 'the XML is read to an object'
17-
def input = persister.read(Cloud, xml)
18-
19-
then: 'the input object equals the given object'
20-
input == object
13+
and: 'the input object equals the given object'
14+
persister.read(Cloud, xml) == object
2115

2216
where:
2317
domain | path | port | protocol | registerProcedure | xml

src/test/groovy/com/github/magneticflux/rss/namespaces/standard/elements/EnclosureTest.groovy

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,11 @@ class EnclosureTest extends PersisterSpecification {
77
@Unroll
88
def 'enclosure #object read/write'() {
99

10-
when: 'the object is written to XML'
11-
def output = persister.write(object)
10+
expect: 'the output XML equals the given XML'
11+
persister.write(object) == xml
1212

13-
then: 'the output XML equals the given XML'
14-
output == xml
15-
16-
when: 'the XML is read to an object'
17-
def input = persister.read(Enclosure, xml)
18-
19-
then: 'the input object equals the given object'
20-
input == object
13+
and: 'the input object equals the given object'
14+
persister.read(Enclosure, xml) == object
2115

2216
where:
2317
url | length | type | xml

0 commit comments

Comments
 (0)