1446 |
|
} |
1447 |
|
} |
1448 |
|
|
1449 |
– |
public abstract class RunnableShouldThrow implements Runnable { |
1450 |
– |
protected abstract void realRun() throws Throwable; |
1451 |
– |
|
1452 |
– |
final Class<?> exceptionClass; |
1453 |
– |
|
1454 |
– |
<T extends Throwable> RunnableShouldThrow(Class<T> exceptionClass) { |
1455 |
– |
this.exceptionClass = exceptionClass; |
1456 |
– |
} |
1457 |
– |
|
1458 |
– |
public final void run() { |
1459 |
– |
try { |
1460 |
– |
realRun(); |
1461 |
– |
threadShouldThrow(exceptionClass.getSimpleName()); |
1462 |
– |
} catch (Throwable t) { |
1463 |
– |
if (! exceptionClass.isInstance(t)) |
1464 |
– |
threadUnexpectedException(t); |
1465 |
– |
} |
1466 |
– |
} |
1467 |
– |
} |
1468 |
– |
|
1449 |
|
public abstract class ThreadShouldThrow extends Thread { |
1450 |
|
protected abstract void realRun() throws Throwable; |
1451 |
|
|