ResultSetFutureCall extends Call.Base<V> implements Call.Mapper<ResultSet, V> { protected abstract ListenableFuture<ResultSet> newFuture();  static boolean isOverCapacity(Throwable e);  }
@Test public void submit_callsFutureGet() throws Exception { when(call.newFuture()).thenReturn(future); when(call.map(resultSet)).thenReturn(resultSet); call.enqueue(callback); future.set(resultSet); verify(callback).onSuccess(resultSet); verifyNoMoreInteractions(callback); }
@Test public void submit_cancel_afterEnqueue() { when(call.newFuture()).thenReturn(future); call.enqueue(callback); call.cancel(); assertThat(call.isCanceled()).isTrue(); assertThat(future.isCancelled()).isTrue(); }
@Test public void submit_callbackError_onErrorCreatingFuture() { when(call.newFuture()).thenThrow(new IllegalArgumentException()); try { call.enqueue(callback); failBecauseExceptionWasNotThrown(IllegalArgumentException.class); } catch (IllegalArgumentException e) { } verify(callback).onError(any(IllegalArgumentException.class)); verifyNoMoreInteractions(callback); }