IpController { @RequestMapping(method = RequestMethod.GET) public CompletableFuture<ResponseEntity<Ip>> ip() { return httpBinService.ip() .thenApply(ResponseEntity::ok); }  @RequestMapping(method = RequestMethod.GET) CompletableFuture<ResponseEntity<Ip>> ip();  }
@Test public void ip() throws Exception { final Ip ip = new Ip("127.0.0.1"); given(httpBinService.ip()).willReturn(CompletableFuture.completedFuture(ip)); ResponseEntity<Ip> responseEntity = ipController.ip().get(); then(httpBinService).should().ip(); assertThat(responseEntity.getStatusCode(), is(HttpStatus.OK)); assertThat(responseEntity.getBody(), is(ip)); }