You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: webtau-core/src/test/groovy/org/testingisdocumenting/webtau/expectation/code/ThrowExceptionMatcherGroovyTest.groovy
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,27 @@ class ThrowExceptionMatcherGroovyTest {
48
48
}
49
49
}
50
50
51
+
@Test
52
+
void"should validate exception using contain matcher mismatch case"() {
53
+
runExpectExceptionAndValidateOutput(AssertionError, contain('> expecting code to throw exception <contain "message1">\n'+
54
+
'X failed expecting code to throw exception <contain "message1">:\n'+
55
+
' exception.message: no match found')) {
56
+
code {
57
+
thrownewRuntimeException('error message')
58
+
} should throwException(contain('message1'))
59
+
}
60
+
}
61
+
62
+
@Test
63
+
void"should validate exception using contain matcher match case"() {
64
+
runAndValidateOutput('> expecting code to throw exception <contain "message">\n'+
65
+
'. code thrown <contain "message"> (Xms)') {
66
+
code {
67
+
thrownewRuntimeException('error message')
68
+
} should throwException(contain('message'))
69
+
}
70
+
}
71
+
51
72
@Test
52
73
void"should validate exception class"() {
53
74
runExpectExceptionAndValidateOutput(AssertionError, contain('X failed expecting code to throw exception java.lang.UnsupportedOperationException:\n'+
0 commit comments