RuntimeException balancerException = new RuntimeException("test balancer exception");
when(serviceBalancer.createAttempt()).thenThrow(balancerException);
balancingHttpClient = createBalancingHttpClient();
ResponseHandler responseHandler = mock(ResponseHandler.class);
RuntimeException handlerException = new RuntimeException("test responseHandler exception");
when(responseHandler.handleException(any(Request.class), any(Exception.class))).thenThrow(handlerException);
assertHandlerExceptionThrown(responseHandler, handlerException);
ArgumentCaptor<Exception> captor = ArgumentCaptor.forClass(Exception.class);
verify(responseHandler).handleException(same(request), captor.capture());