The block
catch( Exception ex ) {
wrapException(ex);
}
is always marked as red though tests pass through it.
The problem is in wrapException method. It maps
exception into some other RuntimeException and throws it:
void wrapException(Throwable ex) {
if( ex instanceof InvocationTargetException ) {
Throwable th = ex.getCause();
if( th instanceof RuntimeException ) throw
(RuntimeException)th;
throw new RuntimeException(th);
}
if( ex instanceof RuntimeException ) throw
(RuntimeException)ex;
throw new RuntimeException(ex);
}
when the function was changed to one returning the
exception ...
RuntimeException wrapException(Throwable ex) {
...
return new RuntimeException(ex);
}
and block was changed to
catch( Exception ex ) {
throw wrapException(ex);
}
EMMA became happy and showed green line.