279 |
|
|
280 |
|
/** |
281 |
|
* threadFail with message "should throw exception" |
282 |
< |
*/ |
282 |
> |
*/ |
283 |
|
public void threadShouldThrow() { |
284 |
< |
threadFailed = true; |
285 |
< |
fail("should throw exception"); |
284 |
> |
try { |
285 |
> |
threadFailed = true; |
286 |
> |
fail("should throw exception"); |
287 |
> |
} catch (AssertionFailedError e) { |
288 |
> |
e.printStackTrace(); |
289 |
> |
throw e; |
290 |
> |
} |
291 |
|
} |
292 |
|
|
293 |
|
/** |
298 |
|
fail("Unexpected exception"); |
299 |
|
} |
300 |
|
|
301 |
+ |
/** |
302 |
+ |
* threadFail with message "Unexpected exception", with argument |
303 |
+ |
*/ |
304 |
+ |
public void threadUnexpectedException(Throwable ex) { |
305 |
+ |
threadFailed = true; |
306 |
+ |
ex.printStackTrace(); |
307 |
+ |
fail("Unexpected exception: " + ex); |
308 |
+ |
} |
309 |
|
|
310 |
|
/** |
311 |
|
* Wait out termination of a thread pool or fail doing so |
415 |
|
Thread.sleep(SHORT_DELAY_MS); |
416 |
|
} |
417 |
|
catch(Exception e) { |
418 |
< |
threadUnexpectedException(); |
418 |
> |
threadUnexpectedException(e); |
419 |
|
} |
420 |
|
} |
421 |
|
} |
437 |
|
Thread.sleep(SMALL_DELAY_MS); |
438 |
|
} |
439 |
|
catch(Exception e) { |
440 |
< |
threadUnexpectedException(); |
440 |
> |
threadUnexpectedException(e); |
441 |
|
} |
442 |
|
} |
443 |
|
} |
458 |
|
Thread.sleep(SMALL_DELAY_MS); |
459 |
|
} |
460 |
|
catch(Exception e) { |
461 |
< |
threadUnexpectedException(); |
461 |
> |
threadUnexpectedException(e); |
462 |
|
} |
463 |
|
return Boolean.TRUE; |
464 |
|
} |
482 |
|
Thread.sleep(MEDIUM_DELAY_MS); |
483 |
|
} |
484 |
|
catch(Exception e) { |
485 |
< |
threadUnexpectedException(); |
485 |
> |
threadUnexpectedException(e); |
486 |
|
} |
487 |
|
} |
488 |
|
} |