Code example for ExecutionException

0
 */ 
public class ExceptionFutureTest { 
 
    @Test 
    public void testGetWithExecutionException() throws InterruptedException { 
        ExecutionException expected = new ExecutionException("My Execution Exception", null);
        Future<Object> exceptionFuture = Futures.immediateFailedFuture(expected);
        try { 
            Object object = exceptionFuture.get();
            fail("An exception should have occur : " + object);
        } catch (ExecutionException actual) {
            // ok 
        } 
    } 
 
    @Test 
    public void testGetWithThrowable() throws InterruptedException { 
        Throwable expected = new IOException("My IOException");
        Future<Object> exceptionFuture = Futures.immediateFailedFuture(expected);
        try {