@Test public void testPost() throws ExecutionException, InterruptedException { assertEquals(0, requests); WebHook hook = new WebHook(getBaseUri() + PREFIX, "{}"); Future<String> future = hook.post(); future.get(); assertEquals(1, requests); }
public Future<String> post() { CompletableFuture<String> completableFuture = new CompletableFuture<>(); Executors.newCachedThreadPool().submit(() -> { int status = RestfulClient.postIt(getURI(), getContent()); completableFuture.complete(String.valueOf(status)); return null; }); return completableFuture; }
WebHook implements Serializable { public Future<String> post() { CompletableFuture<String> completableFuture = new CompletableFuture<>(); Executors.newCachedThreadPool().submit(() -> { int status = RestfulClient.postIt(getURI(), getContent()); completableFuture.complete(String.valueOf(status)); return null; }); return completableFuture; } }
WebHook implements Serializable { public Future<String> post() { CompletableFuture<String> completableFuture = new CompletableFuture<>(); Executors.newCachedThreadPool().submit(() -> { int status = RestfulClient.postIt(getURI(), getContent()); completableFuture.complete(String.valueOf(status)); return null; }); return completableFuture; } WebHook();   WebHook(String URI, String content); }
WebHook implements Serializable { public Future<String> post() { CompletableFuture<String> completableFuture = new CompletableFuture<>(); Executors.newCachedThreadPool().submit(() -> { int status = RestfulClient.postIt(getURI(), getContent()); completableFuture.complete(String.valueOf(status)); return null; }); return completableFuture; } WebHook();   WebHook(String URI, String content); void setURI(String URI); String getURI(); void setContent(String content); String getContent(); Future<String> post(); }
WebHook implements Serializable { public Future<String> post() { CompletableFuture<String> completableFuture = new CompletableFuture<>(); Executors.newCachedThreadPool().submit(() -> { int status = RestfulClient.postIt(getURI(), getContent()); completableFuture.complete(String.valueOf(status)); return null; }); return completableFuture; } WebHook();   WebHook(String URI, String content); void setURI(String URI); String getURI(); void setContent(String content); String getContent(); Future<String> post();  }