Skip to content

Commit 4d8c7ac

Browse files
committed
#84: Refactor RtLocksTest to use StringUtils.join for XML creation.
1 parent 9a4d181 commit 4d8c7ac

1 file changed

Lines changed: 18 additions & 14 deletions

File tree

src/test/java/co/stateful/RtLocksTest.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ final class RtLocksTest {
2323

2424
@Test
2525
void checksExistenceWhenLockPresent() throws Exception {
26-
final String xml = StringUtils.join(
27-
"<page><locks><lock><name>замок-αβγ</name>",
28-
"<label>мітка</label></lock></locks></page>"
29-
);
3026
final MkContainer container = new MkGrizzlyContainer()
31-
.next(new MkAnswer.Simple(xml))
27+
.next(
28+
new MkAnswer.Simple(
29+
StringUtils.join(
30+
"<page><locks><lock><name>замок-αβγ</name>",
31+
"<label>мітка</label></lock></locks></page>"
32+
)
33+
)
34+
)
3235
.start();
3336
try {
3437
MatcherAssert.assertThat(
@@ -43,12 +46,15 @@ void checksExistenceWhenLockPresent() throws Exception {
4346

4447
@Test
4548
void checksExistenceWhenLockAbsent() throws Exception {
46-
final String xml = StringUtils.join(
47-
"<page><locks><lock><name>другий</name>",
48-
"<label>інша</label></lock></locks></page>"
49-
);
5049
final MkContainer container = new MkGrizzlyContainer()
51-
.next(new MkAnswer.Simple(xml))
50+
.next(
51+
new MkAnswer.Simple(
52+
StringUtils.join(
53+
"<page><locks><lock><name>другий</name>",
54+
"<label>інша</label></lock></locks></page>"
55+
)
56+
)
57+
)
5258
.start();
5359
try {
5460
MatcherAssert.assertThat(
@@ -63,9 +69,8 @@ void checksExistenceWhenLockAbsent() throws Exception {
6369

6470
@Test
6571
void checksExistenceWithEmptyLocksPage() throws Exception {
66-
final String xml = "<page><locks></locks></page>";
6772
final MkContainer container = new MkGrizzlyContainer()
68-
.next(new MkAnswer.Simple(xml))
73+
.next(new MkAnswer.Simple("<page><locks></locks></page>"))
6974
.start();
7075
try {
7176
MatcherAssert.assertThat(
@@ -80,9 +85,8 @@ void checksExistenceWithEmptyLocksPage() throws Exception {
8085

8186
@Test
8287
void existsSendsAcceptXmlHeader() throws Exception {
83-
final String xml = "<page><locks></locks></page>";
8488
final MkContainer container = new MkGrizzlyContainer()
85-
.next(new MkAnswer.Simple(xml))
89+
.next(new MkAnswer.Simple("<page><locks></locks></page>"))
8690
.start();
8791
try {
8892
new RtLocks(new JdkRequest(container.home())).exists("замок");

0 commit comments

Comments
 (0)