The Compare Exception operator specifies an exception as an expected value. We can check the exception message, the exception type name (no namespace), or both:
- exception[typename]
- exception["message"]
- exception[typename: "message"]
when input is⇓
| story test fixture |
| check | plain test | 'sample domain'
|compute
message throw
'oh no' 'exception["oh no"]'
oops exception[ApplicationException]
null exception[NullReferenceException]
help 'exception[ApplicationException: "help"]'
OK exception[ApplicationException]
check throw 'oh no' 'exception["oh no"]' |
| compute | | message | throw | | oh no | exception["oh no"] | | oops | exception[ApplicationException] | | null | exception[NullReferenceException] | | help | exception[ApplicationException: "help"] | | OK | exception[ApplicationException] expected OK actual |
| check | throw | oh no | exception["oh no"] |
|
| 'sample domain'
|compute
message throw
'oh no' 'exception["oh no"]'
oops exception[ApplicationException]
null exception[NullReferenceException]
help 'exception[ApplicationException: "help"]'
OK exception[ApplicationException]
check throw 'oh no' 'exception["oh no"]' | then output is |
| compute | | message | throw | | oh no | exception["oh no"] | | oops | exception[ApplicationException] | | null | exception[NullReferenceException] | | help | exception[ApplicationException: "help"] | | OK | exception[ApplicationException] expected OK actual |
| check | throw | oh no | exception["oh no"] |
|