Code example for ExecutionException

Methods: getCause

0
        mInstrumentation.waitForIdle(future);
        try { 
            return future.get();
        } catch (ExecutionException e) {
            // Unwrap the cause of the exception and re-throw it. 
            throw e.getCause();
        } 
    } 
 
    /** 
     * Wake up the screen, useful in tests that want or need the screen to be on. 
     * <p> 
     * This is usually called from setUp() for tests that require it.  After calling this method, 
     * {@link #releaseScreenWakeLock()} must be called, this is usually done from tearDown(). 
     */ 
    public void acquireScreenWakeLock(Context context) {
        synchronized (mLock) {
            Preconditions.checkState(mWakeLock == null, "mWakeLock was already held");
            mWakeLock = ((PowerManager) context.getSystemService(Context.POWER_SERVICE))
                    .newWakeLock(ACQUIRE_CAUSES_WAKEUP | ON_AFTER_RELEASE | FULL_WAKE_LOCK, TAG);
            mWakeLock.acquire();