@Test(expectedExceptions = PropagatedRuntimeException.class) public void testRunnablePropagatesEx() throws IOException { HttpClient httpClient = mock(HttpClient.class); when(httpClient.execute(any(HttpGet.class))).thenThrow(MyCustomException.class); new RequestCheckRunnable.Builder(mockRequest("http: }
@Override public void run() { boolean done = Repeater.create(String.format("Request %s status check", builder.request.toString())) .every(Duration.ONE_SECOND) .until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { final String json = HttpTool.httpGet(builder.httpClient, URI.create(builder.request.getHref()), builder.headers).getContentAsString(); final String status = JsonPath.read(json, "$.Requests.request_status"); if (!VALID_STATES.contains(status)) { throw new RuntimeException( "Request fails with state " + status + ". Check here for details " + builder.request.getHref()); } return StringUtils.equals(status, "COMPLETED"); } }) .limitTimeTo(builder.timeout) .rethrowExceptionImmediately() .run(); if (!done) { throw new RuntimeException(builder.errorMessage); } }
RequestCheckRunnable implements Runnable { @Override public void run() { boolean done = Repeater.create(String.format("Request %s status check", builder.request.toString())) .every(Duration.ONE_SECOND) .until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { final String json = HttpTool.httpGet(builder.httpClient, URI.create(builder.request.getHref()), builder.headers).getContentAsString(); final String status = JsonPath.read(json, "$.Requests.request_status"); if (!VALID_STATES.contains(status)) { throw new RuntimeException( "Request fails with state " + status + ". Check here for details " + builder.request.getHref()); } return StringUtils.equals(status, "COMPLETED"); } }) .limitTimeTo(builder.timeout) .rethrowExceptionImmediately() .run(); if (!done) { throw new RuntimeException(builder.errorMessage); } } }
RequestCheckRunnable implements Runnable { @Override public void run() { boolean done = Repeater.create(String.format("Request %s status check", builder.request.toString())) .every(Duration.ONE_SECOND) .until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { final String json = HttpTool.httpGet(builder.httpClient, URI.create(builder.request.getHref()), builder.headers).getContentAsString(); final String status = JsonPath.read(json, "$.Requests.request_status"); if (!VALID_STATES.contains(status)) { throw new RuntimeException( "Request fails with state " + status + ". Check here for details " + builder.request.getHref()); } return StringUtils.equals(status, "COMPLETED"); } }) .limitTimeTo(builder.timeout) .rethrowExceptionImmediately() .run(); if (!done) { throw new RuntimeException(builder.errorMessage); } } protected  RequestCheckRunnable(Builder builder); }
RequestCheckRunnable implements Runnable { @Override public void run() { boolean done = Repeater.create(String.format("Request %s status check", builder.request.toString())) .every(Duration.ONE_SECOND) .until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { final String json = HttpTool.httpGet(builder.httpClient, URI.create(builder.request.getHref()), builder.headers).getContentAsString(); final String status = JsonPath.read(json, "$.Requests.request_status"); if (!VALID_STATES.contains(status)) { throw new RuntimeException( "Request fails with state " + status + ". Check here for details " + builder.request.getHref()); } return StringUtils.equals(status, "COMPLETED"); } }) .limitTimeTo(builder.timeout) .rethrowExceptionImmediately() .run(); if (!done) { throw new RuntimeException(builder.errorMessage); } } protected  RequestCheckRunnable(Builder builder); static Builder check(Request request); @Override void run(); }
RequestCheckRunnable implements Runnable { @Override public void run() { boolean done = Repeater.create(String.format("Request %s status check", builder.request.toString())) .every(Duration.ONE_SECOND) .until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { final String json = HttpTool.httpGet(builder.httpClient, URI.create(builder.request.getHref()), builder.headers).getContentAsString(); final String status = JsonPath.read(json, "$.Requests.request_status"); if (!VALID_STATES.contains(status)) { throw new RuntimeException( "Request fails with state " + status + ". Check here for details " + builder.request.getHref()); } return StringUtils.equals(status, "COMPLETED"); } }) .limitTimeTo(builder.timeout) .rethrowExceptionImmediately() .run(); if (!done) { throw new RuntimeException(builder.errorMessage); } } protected  RequestCheckRunnable(Builder builder); static Builder check(Request request); @Override void run();  }