### Question:
ParseSax implements Function<HttpResponse, T>, InvocationContext<ParseSax<T>> { public T addDetailsAndPropagate(HttpResponse response, Exception e) { return addDetailsAndPropagate(response, e, null); } ParseSax(XMLReader parser, HandlerWithResult<T> handler); T apply(HttpResponse from); T parse(String from); T parse(InputStream from); T parse(InputSource from); T addDetailsAndPropagate(HttpResponse response, Exception e); T addDetailsAndPropagate(HttpResponse response, Exception e, @Nullable String text); HandlerWithResult<T> getHandler(); @Override ParseSax<T> setContext(HttpRequest request);  }### Answer:
@Test public void testAddDetailsAndPropagateOkWhenRequestWithNoDataAndRuntimeExceptionThrowsOriginalException() { ParseSax<String> parser = createParser(); Exception input = new RuntimeException("foo"); try { parser.addDetailsAndPropagate(null, input); } catch (RuntimeException e) { assertEquals(e, input); } }
@Test public void testAddDetailsAndPropagateOkWhenRequestWithNoDataAndExceptionPropagates() { ParseSax<String> parser = createParser(); Exception input = new Exception("foo"); try { parser.addDetailsAndPropagate(null, input); } catch (RuntimeException e) { assertEquals(e.getMessage(), "java.lang.Exception: foo"); assertEquals(e.getCause(), input); } }
@Test public void testAddDetailsAndPropagateOkWhenRequestWithNoDataAndRuntimeExceptionThrowsOriginalException() throws ExecutionException, InterruptedException, TimeoutException, IOException { ParseSax<String> parser = createParser(); Exception input = new RuntimeException("foo"); try { parser.addDetailsAndPropagate(null, input); } catch (RuntimeException e) { assertEquals(e, input); } }
@Test public void testAddDetailsAndPropagateOkWhenRequestWithNoDataAndExceptionPropagates() throws ExecutionException, InterruptedException, TimeoutException, IOException { ParseSax<String> parser = createParser(); Exception input = new Exception("foo"); try { parser.addDetailsAndPropagate(null, input); } catch (RuntimeException e) { assertEquals(e.getMessage(), "java.lang.Exception: foo"); assertEquals(e.getCause(), input); } }