27Oct00
Procedural Macros for Java
Bachrach and Playford
TestSuite Macros
check foo.equals(bar);
check foo.equals(bar) throws NullPointerException;
=>
try {
  logCheck("foo.equals(bar)");
  checkAssertion(foo.equals(bar));
} catch (Throwable t) {
  unexpectedThrowFailure(t);
};
try {
  logCheck("foo.equals(bar) throws NullPointerException");
  foo.equals(bar);
  noThrowFailure();
} catch (NullPointerException e) {
  checkPassed();
} catch (Throwable t) {
  incorrectThrowFailure(t);
};
Sun's standard JavaTest framework sucks from the point of view of test authoring;
it's very verbose to write robust tests and tests involving exceptions just go on and on.
You have to write extra code if you want to be able to tell from a test log exactly where a failure occurred.
In fact, because it's so longwinded to test for unexpected exceptions on a check-by-check basis
like the first case people don't tend to bother, causing test suites to bomb out at the first such failure.