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
There are two approaches to check the cause and root cause, either directly or navigate to it with `getCause()` and `getRootCause()` and check it.
1301
+
There are two approaches to check the cause and root cause, either directly or navigate to it with `cause()` and `rootCause()` and check it.
1302
1302
1303
1303
====== Checking the cause
1304
1304
1305
-
You can check the cause directly if you know it but that's not always possible, in that case you can basically only check its type.
1306
-
This is pretty limited in term of assertions, a better approach is to navigate to the cause with `getCause()` and take advantage of all existing exception assertions.
1305
+
You can check the cause directly if you know it, but that's not always possible, and in such cases you can only check its type.
1306
+
This is pretty limited in terms of assertions, a better approach is to navigate to the cause with `cause()` and take advantage of all existing exception assertions.
1307
1307
1308
-
Direct cause assertion are limited ...
1308
+
Direct cause assertions are limited ...
1309
1309
[source,java]
1310
1310
----
1311
1311
NullPointerException cause = new NullPointerException("boom!");
You can check the root cause directly with `hasRootCause`, `hasRootCauseMessage` and `hasRootCauseInstanceOf` if you have access to it but that's not always possible, this is a bit limited
1356
-
in term of assertions, a better way is to navigate to the root cause with `getRootCause()` and take advantage of all existing exception assertions.
1356
+
in terms of assertions, a better way is to navigate to the root cause with `rootCause()` and take advantage of all existing exception assertions.
0 commit comments