Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1031635 // assertNoException - assert that a code fragment runs without an exception (throwable)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3518L/21K).

svoid assertNoException(S msg default "", Runnable r) {
  try {
    r.run();
  } catch e {
    fail(msg, e);
  }
}

svoid assertNoException(Scorer scorer, S msg default "", Runnable r) {
  try {
    r.run();
    scorer.ok(msg);
  } catch e {
    scorer.error(toPersistableThrowable(new RuntimeException(msg, e)));
  }
}

Author comment

Began life as a copy of #1005129

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031635
Snippet name: assertNoException - assert that a code fragment runs without an exception (throwable)
Eternal ID of this version: #1031635/2
Text MD5: de00849fe881f2097d0b61d30992100e
Transpilation MD5: b7956f8a33245ad2fd6693bc9f90c905
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-24 19:26:03
Source code size: 334 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 78 / 118
Version history: 1 change(s)
Referenced in: [show references]