### Question:
CoapProtocolClient implements ProtocolClient { @Override public CompletableFuture<Content> writeResource(Form form, Content content) { CompletableFuture<Content> future = new CompletableFuture<>(); String url = form.getHref(); CoapClient client = clientCreator.apply(url); Request request = generateRequest(form, CoAP.Code.PUT); log.debug("CoapClient sending '{}' to '{}'", request.getCode(), url); if (content != null) { request.setPayload(content.getBody()); } client.advanced(new FutureCoapHandler(future), request); return future; } CoapProtocolClient(ExecutorService executor);   CoapProtocolClient(Function<String, CoapClient> clientCreator); @Override CompletableFuture<Content> readResource(Form form); @Override CompletableFuture<Content> writeResource(Form form, Content content); @Override CompletableFuture<Content> invokeResource(Form form, Content content); @Override Observable<Content> observeResource(Form form);  }### Answer:
@Test public void writeResourceShouldCreateCoapRequest() { when(clientCreator.apply(any())).thenReturn(coapClient); CoapProtocolClient client = new CoapProtocolClient(clientCreator); client.writeResource(form, content); verify(coapClient, timeout(1 * 1000L)).advanced(any(), any()); }