| 281 |
* threadFail with message "should throw exception" |
* threadFail with message "should throw exception" |
| 282 |
*/ |
*/ |
| 283 |
public void threadShouldThrow() { |
public void threadShouldThrow() { |
| 284 |
|
try { |
| 285 |
threadFailed = true; |
threadFailed = true; |
| 286 |
fail("should throw exception"); |
fail("should throw exception"); |
| 287 |
|
} catch (AssertionFailedError e) { |
| 288 |
|
e.printStackTrace(); |
| 289 |
|
throw e; |
| 290 |
|
} |
| 291 |
} |
} |
| 292 |
|
|
| 293 |
/** |
/** |
| 298 |
fail("Unexpected exception"); |
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 |
* Wait out termination of a thread pool or fail doing so |
| 415 |
Thread.sleep(SHORT_DELAY_MS); |
Thread.sleep(SHORT_DELAY_MS); |
| 416 |
} |
} |
| 417 |
catch(Exception e) { |
catch(Exception e) { |
| 418 |
threadUnexpectedException(); |
threadUnexpectedException(e); |
| 419 |
} |
} |
| 420 |
} |
} |
| 421 |
} |
} |
| 437 |
Thread.sleep(SMALL_DELAY_MS); |
Thread.sleep(SMALL_DELAY_MS); |
| 438 |
} |
} |
| 439 |
catch(Exception e) { |
catch(Exception e) { |
| 440 |
threadUnexpectedException(); |
threadUnexpectedException(e); |
| 441 |
} |
} |
| 442 |
} |
} |
| 443 |
} |
} |
| 458 |
Thread.sleep(SMALL_DELAY_MS); |
Thread.sleep(SMALL_DELAY_MS); |
| 459 |
} |
} |
| 460 |
catch(Exception e) { |
catch(Exception e) { |
| 461 |
threadUnexpectedException(); |
threadUnexpectedException(e); |
| 462 |
} |
} |
| 463 |
return Boolean.TRUE; |
return Boolean.TRUE; |
| 464 |
} |
} |
| 482 |
Thread.sleep(MEDIUM_DELAY_MS); |
Thread.sleep(MEDIUM_DELAY_MS); |
| 483 |
} |
} |
| 484 |
catch(Exception e) { |
catch(Exception e) { |
| 485 |
threadUnexpectedException(); |
threadUnexpectedException(e); |
| 486 |
} |
} |
| 487 |
} |
} |
| 488 |
} |
} |