Skip to content

Commit c8f0320

Browse files
matchers: intro doc failure example update (#1593)
1 parent d22a3c3 commit c8f0320

13 files changed

Lines changed: 71 additions & 63 deletions

File tree

webtau-core/src/test/java/org/testingisdocumenting/webtau/MatchersTest.java

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -346,19 +346,26 @@ private static TableData loadFromCsv(String fileName) {
346346

347347
@Test
348348
public void listFailureExample() {
349-
doc.console.capture("list-failure", () -> {
350-
code(() -> {
351-
List<?> values = Arrays.asList(
352-
1,
353-
"testing",
354-
map("key1", "hello", "key2", "world"));
355-
// failed-list
356-
actual(values).should(equal(Arrays.asList(
357-
1,
358-
"teasing",
359-
map("key1", "hello", "key2", "work"))));
360-
// failed-list
361-
}).should(throwException(AssertionError.class));
349+
runExpectExceptionCaptureAndValidateOutput(AssertionError.class, "list-failure", """
350+
X failed expecting [value] to equal [1, "teasing", {"key1": "hello", "key2": "work"}]:
351+
[value][1]: actual: "testing" <java.lang.String>
352+
expected: "teasing" <java.lang.String>
353+
^
354+
[value][2].key2: actual: "world" <java.lang.String>
355+
expected: "work" <java.lang.String>
356+
^ (Xms)
357+
\s
358+
[1, **"testing"**, {"key1": "hello", "key2": **"world"**}]""", () -> {
359+
List<?> values = Arrays.asList(
360+
1,
361+
"testing",
362+
map("key1", "hello", "key2", "world"));
363+
// failed-list
364+
actual(values).should(equal(Arrays.asList(
365+
1,
366+
"teasing",
367+
map("key1", "hello", "key2", "work"))));
368+
// failed-list
362369
});
363370
}
364371

webtau-docs/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<plugin>
6060
<groupId>org.testingisdocumenting.znai</groupId>
6161
<artifactId>znai-maven-plugin</artifactId>
62-
<version>1.66</version>
62+
<version>1.69</version>
6363
<executions>
6464
<execution>
6565
<id>guide</id>

webtau-docs/znai/browser/asynchronous-page.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Note: any matcher that you can use with `should` and `shouldNot` can be used wit
3232

3333
Use `change` matcher when you want to wait for any change of a value without knowing the specifics.
3434

35-
:include-file: doc-artifacts/snippets/matchers/snapshotAndChange.groovy {title: "wait for change", noGap: true, noGapSeparator: true}
35+
:include-file: doc-artifacts/snippets/matchers/snapshotAndChange.groovy {title: "wait for change", noGap: true, noGapBorder: true}
3636
:include-cli-output: doc-artifacts/matchers.groovy-console-output.txt {startLine: "change matcher", endLine: "change matcher", excludeStartEnd: true}
3737

3838
# Wait on url

webtau-docs/znai/browser/matchers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ It is not required when you do an explicit comparison with the list on the right
4141

4242
# Snapshot And Change
4343

44-
:include-file: doc-artifacts/snippets/matchers/snapshotAndChange.groovy {title: "wait for change", noGap: true, noGapSeparator: true}
44+
:include-file: doc-artifacts/snippets/matchers/snapshotAndChange.groovy {title: "wait for change", noGap: true, noGapBorder: true}
4545
:include-cli-output: doc-artifacts/matchers.groovy-console-output.txt {startLine: "change matcher", endLine: "change matcher", excludeStartEnd: true}
4646

4747

webtau-docs/znai/matchers/any-value.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Groovy:
88
:include-file: org/testingisdocumenting/webtau/MatchersGroovyTest.groovy {
99
surroundedBy: "any-value-table-example",
1010
noGap: true,
11-
noGapSeparator: true
11+
noGapBorder: true
1212
}
1313
:include-cli-output: doc-artifacts/any-value-table-output.txt
1414
@@ -18,7 +18,7 @@ Java:
1818
:include-file: org/testingisdocumenting/webtau/MatchersTest.java {
1919
surroundedBy: "any-value-table-example",
2020
noGap: true,
21-
noGapSeparator: true
21+
noGapBorder: true
2222
}
2323
:include-cli-output: doc-artifacts/any-value-table-output.txt
2424

webtau-docs/znai/matchers/introduction.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Groovy:
1717
surroundedBy: "string-string-example",
1818
commentsType: "remove",
1919
noGap: true,
20-
noGapSeparator: true
20+
noGapBorder: true
2121
}
2222
:include-cli-output: doc-artifacts/string-string-comparison-output.txt
2323
@@ -31,7 +31,7 @@ Java:
3131
surroundedBy: "string-string-example",
3232
commentsType: "remove",
3333
noGap: true,
34-
noGapSeparator: true
34+
noGapBorder: true
3535
}
3636
:include-cli-output: doc-artifacts/string-string-comparison-output.txt
3737
@@ -48,7 +48,7 @@ Groovy:
4848
surroundedBy: "string-number-example",
4949
commentsType: "remove",
5050
noGap: true,
51-
noGapSeparator: true
51+
noGapBorder: true
5252
}
5353
:include-cli-output: doc-artifacts/string-number-comparison-output.txt
5454
@@ -58,7 +58,7 @@ Java:
5858
surroundedBy: "string-number-example",
5959
commentsType: "remove",
6060
noGap: true,
61-
noGapSeparator: true
61+
noGapBorder: true
6262
}
6363
:include-cli-output: doc-artifacts/string-number-comparison-output.txt
6464
```
@@ -73,7 +73,7 @@ Groovy:
7373
title: "waitTo example",
7474
surroundedBy: "wait-consume-message",
7575
noGap: true,
76-
noGapSeparator: true
76+
noGapBorder: true
7777
}
7878
:include-cli-output: doc-artifacts/wait-message-output.txt
7979
@@ -82,7 +82,7 @@ Java:
8282
title: "waitTo example",
8383
surroundedBy: "wait-consume-message",
8484
noGap: true,
85-
noGapSeparator: true
85+
noGapBorder: true
8686
}
8787
:include-cli-output: doc-artifacts/wait-message-output.txt
8888
```
@@ -96,7 +96,7 @@ Groovy:
9696
title: "waitToBe example",
9797
surroundedBy: "wait-number-records",
9898
noGap: true,
99-
noGapSeparator: true
99+
noGapBorder: true
100100
}
101101
:include-cli-output: doc-artifacts/wait-tobe-output.txt
102102
@@ -105,7 +105,7 @@ Java:
105105
title: "waitToBe example",
106106
surroundedBy: "wait-number-records",
107107
noGap: true,
108-
noGapSeparator: true
108+
noGapBorder: true
109109
}
110110
:include-cli-output: doc-artifacts/wait-tobe-output.txt
111111
```
@@ -120,7 +120,7 @@ Groovy:
120120
title: "shouldNot example",
121121
surroundedBy: "string-string-negative-example",
122122
noGap: true,
123-
noGapSeparator: true
123+
noGapBorder: true
124124
}
125125
:include-cli-output: doc-artifacts/string-string-negative-comparison-output.txt
126126
@@ -129,7 +129,7 @@ Java:
129129
title: "shouldNot example",
130130
surroundedBy: "string-string-negative-example",
131131
noGap: true,
132-
noGapSeparator: true
132+
noGapBorder: true
133133
}
134134
:include-cli-output: doc-artifacts/string-string-negative-comparison-output.txt
135135
```
@@ -140,7 +140,7 @@ Groovy:
140140
title: "waitToNot example",
141141
surroundedBy: "wait-negative-consume-message",
142142
noGap: true,
143-
noGapSeparator: true
143+
noGapBorder: true
144144
}
145145
:include-cli-output: doc-artifacts/wait-negative-message-output.txt
146146
@@ -149,7 +149,7 @@ Java:
149149
title: "waitToNot example",
150150
surroundedBy: "wait-negative-consume-message",
151151
noGap: true,
152-
noGapSeparator: true
152+
noGapBorder: true
153153
}
154154
:include-cli-output: doc-artifacts/wait-negative-message-output.txt
155155
```
@@ -166,7 +166,7 @@ Groovy:
166166
title: "assertion",
167167
surroundedBy: "failed-list",
168168
noGap: true,
169-
noGapSeparator: true
169+
noGapBorder: true
170170
}
171171
:include-cli-output: doc-artifacts/list-failure.txt
172172
@@ -175,7 +175,7 @@ Java:
175175
title: "assertion",
176176
surroundedBy: "failed-list",
177177
noGap: true,
178-
noGapSeparator: true
178+
noGapBorder: true
179179
}
180180
:include-cli-output: doc-artifacts/list-failure.txt
181181
```

webtau-docs/znai/matchers/java-beans-and-records.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Groovy:
8181
surroundedBy: "beans-table-contain-example",
8282
commentsType: "inline",
8383
noGap: true,
84-
noGapSeparator: true
84+
noGapBorder: true
8585
}
8686
:include-cli-output: doc-artifacts/beans-table-contain-output.txt
8787
@@ -90,7 +90,7 @@ Java:
9090
surroundedBy: "beans-table-contain-example",
9191
commentsType: "inline",
9292
noGap: true,
93-
noGapSeparator: true
93+
noGapBorder: true
9494
}
9595
:include-cli-output: doc-artifacts/beans-table-contain-output.txt
9696
```

webtau-docs/znai/matchers/maps.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Groovy:
77
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/MapMatchersGroovyExamplesTest.groovy {
88
surroundedBy: "maps-equal-mismatch",
99
noGap: true,
10-
noGapSeparator: true
10+
noGapBorder: true
1111
}
1212
:include-cli-output: doc-artifacts/maps-equal-console-output.txt
1313
:include-markdown: import-ref.md
@@ -16,7 +16,7 @@ Java:
1616
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/MapMatchersJavaExamplesTest.java {
1717
surroundedBy: "maps-equal-mismatch",
1818
noGap: true,
19-
noGapSeparator: true
19+
noGapBorder: true
2020
}
2121
:include-cli-output: doc-artifacts/maps-equal-console-output.txt
2222
:include-markdown: import-ref.md
@@ -32,15 +32,15 @@ Groovy:
3232
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/MapMatchersGroovyExamplesTest.groovy {
3333
surroundedBy: "maps-contain-mismatch",
3434
noGap: true,
35-
noGapSeparator: true
35+
noGapBorder: true
3636
}
3737
:include-cli-output: doc-artifacts/maps-contain-console-output.txt
3838
3939
Java:
4040
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/MapMatchersJavaExamplesTest.java {
4141
surroundedBy: "maps-contain-mismatch",
4242
noGap: true,
43-
noGapSeparator: true
43+
noGapBorder: true
4444
}
4545
:include-cli-output: doc-artifacts/maps-contain-console-output.txt
4646
```

webtau-docs/znai/matchers/strings.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Groovy:
77
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/StringMatchersGroovyExamplesTest.groovy {
88
surroundedBy: "single-line-compare",
99
noGap: true,
10-
noGapSeparator: true
10+
noGapBorder: true
1111
}
1212
:include-cli-output: doc-artifacts/single-line-string-compare-output.txt
1313
:include-markdown: import-ref.md
@@ -16,7 +16,7 @@ Java:
1616
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/StringMatchersJavaExamplesTest.java {
1717
surroundedBy: "single-line-compare",
1818
noGap: true,
19-
noGapSeparator: true
19+
noGapBorder: true
2020
}
2121
:include-cli-output: doc-artifacts/single-line-string-compare-output.txt
2222
:include-markdown: import-ref.md
@@ -32,15 +32,15 @@ Groovy:
3232
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/StringMatchersGroovyExamplesTest.groovy {
3333
surroundedBy: "multi-line-compare",
3434
noGap: true,
35-
noGapSeparator: true
35+
noGapBorder: true
3636
}
3737
:include-cli-output: doc-artifacts/multi-line-string-compare-output.txt
3838
3939
Java:
4040
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/StringMatchersJavaExamplesTest.java {
4141
surroundedBy: "multi-line-compare",
4242
noGap: true,
43-
noGapSeparator: true
43+
noGapBorder: true
4444
}
4545
:include-cli-output: doc-artifacts/multi-line-string-compare-output.txt
4646
```
@@ -62,15 +62,15 @@ Groovy:
6262
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/StringMatchersGroovyExamplesTest.groovy {
6363
surroundedBy: "extra-empty-line-compare",
6464
noGap: true,
65-
noGapSeparator: true
65+
noGapBorder: true
6666
}
6767
:include-cli-output: doc-artifacts/extra-empty-line-string-compare-output.txt
6868
6969
Java:
7070
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/StringMatchersJavaExamplesTest.java {
7171
surroundedBy: "extra-empty-line-compare",
7272
noGap: true,
73-
noGapSeparator: true
73+
noGapBorder: true
7474
}
7575
:include-cli-output: doc-artifacts/extra-empty-line-string-compare-output.txt
7676
```
@@ -84,15 +84,15 @@ Groovy:
8484
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/StringMatchersGroovyExamplesTest.groovy {
8585
surroundedBy: "multi-line-contains",
8686
noGap: true,
87-
noGapSeparator: true
87+
noGapBorder: true
8888
}
8989
:include-cli-output: doc-artifacts/string-contains-output.txt
9090
9191
Java:
9292
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/StringMatchersJavaExamplesTest.java {
9393
surroundedBy: "multi-line-contains",
9494
noGap: true,
95-
noGapSeparator: true
95+
noGapBorder: true
9696
}
9797
:include-cli-output: doc-artifacts/string-contains-output.txt
9898
```
@@ -106,15 +106,15 @@ Groovy:
106106
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/StringMatchersGroovyExamplesTest.groovy {
107107
surroundedBy: "single-line-regexp",
108108
noGap: true,
109-
noGapSeparator: true
109+
noGapBorder: true
110110
}
111111
:include-cli-output: doc-artifacts/string-regexp-output.txt
112112
113113
Java:
114114
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/StringMatchersJavaExamplesTest.java {
115115
surroundedBy: "single-line-regexp",
116116
noGap: true,
117-
noGapSeparator: true
117+
noGapBorder: true
118118
}
119119
:include-cli-output: doc-artifacts/string-regexp-output.txt
120120
```

webtau-docs/znai/matchers/tables.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Groovy:
77
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/TableDataMatchersGroovyExamplesTest.groovy {
88
surroundedBy: "table-equal-mismatch",
99
noGap: true,
10-
noGapSeparator: true
10+
noGapBorder: true
1111
}
1212
:include-cli-output: doc-artifacts/table-equal-console-output.txt
1313
:include-markdown: import-ref.md
@@ -16,7 +16,7 @@ Java:
1616
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/TableDataMatchersJavaExamplesTest.java {
1717
surroundedBy: "table-equal-mismatch",
1818
noGap: true,
19-
noGapSeparator: true
19+
noGapBorder: true
2020
}
2121
:include-cli-output: doc-artifacts/table-equal-console-output.txt
2222
:include-markdown: import-ref.md
@@ -31,15 +31,15 @@ Groovy:
3131
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/TableDataMatchersGroovyExamplesTest.groovy {
3232
surroundedBy: "table-contain-mismatch",
3333
noGap: true,
34-
noGapSeparator: true
34+
noGapBorder: true
3535
}
3636
:include-cli-output: doc-artifacts/table-contain-console-output.txt
3737
3838
Java:
3939
:include-file: org/testingisdocumenting/webtau/expectation/equality/handlers/TableDataMatchersJavaExamplesTest.java {
4040
surroundedBy: "table-contain-mismatch",
4141
noGap: true,
42-
noGapSeparator: true
42+
noGapBorder: true
4343
}
4444
:include-cli-output: doc-artifacts/table-contain-console-output.txt
4545
```

0 commit comments

Comments
 (0)