JUnit Exception Testing

From NovaOrdis Knowledge Base
Revision as of 23:28, 26 August 2020 by Ovidiu (talk | contribs) (→‎Internal)
Jump to navigation Jump to search

External

Internal

Idioms

Try/Catch

try {
  ...
  fail("should have thrown exception");
}
catch(SomeException e) {
  assertEquals("some message", e.getMessage());
}

assertThrows()