RunResponseHandler implements ResponseHandler { @Override public void onFailure( Throwable error ) { completeRunFuture( error ); } RunResponseHandler( MetadataExtractor metadataExtractor );  RunResponseHandler( CompletableFuture<Throwable> runCompletedFuture, MetadataExtractor metadataExtractor ); @Override void onSuccess( Map<String,Value> metadata ); @Override void onFailure( Throwable error ); @Override void onRecord( Value[] fields ); QueryKeys queryKeys(); long resultAvailableAfter(); long queryId(); CompletableFuture<Throwable> runFuture();  }
@Test void shouldNotifyCompletionFutureOnFailure() throws Exception { CompletableFuture<Throwable> runCompletedFuture = new CompletableFuture<>(); RunResponseHandler handler = newHandler( runCompletedFuture ); assertFalse( runCompletedFuture.isDone() ); handler.onFailure( new RuntimeException() ); assertTrue( runCompletedFuture.isDone() ); assertNotNull( runCompletedFuture.get() ); }