@Test(expected = IllegalArgumentException.class) public void exceptionWhenRetrievingImageWithInvalidCaptureId() throws InterruptedException, ExecutionException, TimeoutException { mImageProxyBundle.getImageProxy(CAPTURE_ID_NONEXISTANT).get(0, TimeUnit.SECONDS); }
@Override public ListenableFuture<ImageProxy> getImageProxy(int captureId) { synchronized (mLock) { if (mClosed) { throw new IllegalStateException("ImageProxyBundle already closed."); } ListenableFuture<ImageProxy> result = mFutureResults.get(captureId); if (result == null) { throw new IllegalArgumentException( "ImageProxyBundle does not contain this id: " + captureId); } return result; } }
SettableImageProxyBundle implements ImageProxyBundle { @Override public ListenableFuture<ImageProxy> getImageProxy(int captureId) { synchronized (mLock) { if (mClosed) { throw new IllegalStateException("ImageProxyBundle already closed."); } ListenableFuture<ImageProxy> result = mFutureResults.get(captureId); if (result == null) { throw new IllegalArgumentException( "ImageProxyBundle does not contain this id: " + captureId); } return result; } } }
SettableImageProxyBundle implements ImageProxyBundle { @Override public ListenableFuture<ImageProxy> getImageProxy(int captureId) { synchronized (mLock) { if (mClosed) { throw new IllegalStateException("ImageProxyBundle already closed."); } ListenableFuture<ImageProxy> result = mFutureResults.get(captureId); if (result == null) { throw new IllegalArgumentException( "ImageProxyBundle does not contain this id: " + captureId); } return result; } } SettableImageProxyBundle(List<Integer> captureIds); }
SettableImageProxyBundle implements ImageProxyBundle { @Override public ListenableFuture<ImageProxy> getImageProxy(int captureId) { synchronized (mLock) { if (mClosed) { throw new IllegalStateException("ImageProxyBundle already closed."); } ListenableFuture<ImageProxy> result = mFutureResults.get(captureId); if (result == null) { throw new IllegalArgumentException( "ImageProxyBundle does not contain this id: " + captureId); } return result; } } SettableImageProxyBundle(List<Integer> captureIds); @Override ListenableFuture<ImageProxy> getImageProxy(int captureId); @Override List<Integer> getCaptureIds(); }
SettableImageProxyBundle implements ImageProxyBundle { @Override public ListenableFuture<ImageProxy> getImageProxy(int captureId) { synchronized (mLock) { if (mClosed) { throw new IllegalStateException("ImageProxyBundle already closed."); } ListenableFuture<ImageProxy> result = mFutureResults.get(captureId); if (result == null) { throw new IllegalArgumentException( "ImageProxyBundle does not contain this id: " + captureId); } return result; } } SettableImageProxyBundle(List<Integer> captureIds); @Override ListenableFuture<ImageProxy> getImageProxy(int captureId); @Override List<Integer> getCaptureIds();  }