1 | static void expectException(Class exceptionType, Runnable r) { |
2 | try { |
3 | r.run(); |
4 | } catch e { |
5 | e = unwrapTrivialExceptionWraps(e); |
6 | if (!isInstance(exceptionType, e)) |
7 | fail("Wrong exception type, was expecting " + exceptionType, e); |
8 | silentException(e); |
9 | ret; |
10 | } |
11 | fail("No exception thrown!"); |
12 | } |
Began life as a copy of #1005129
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015931 |
Snippet name: | expectException - assert that a code fragment throws an exception of a certain kind |
Eternal ID of this version: | #1015931/2 |
Text MD5: | 3cd37c4db7895b387cff65055844ca53 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-31 01:30:29 |
Source code size: | 329 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 348 / 372 |
Version history: | 1 change(s) |
Referenced in: | [show references] |