@Test public void fetch_test() { String url = "https: RestTemplate restTemplate = mock(RestTemplate.class); when(restTemplate.getForObject(eq(url), eq(String.class))).thenReturn("response"); RestTemplateAdaptorHttpClient httpClient = new RestTemplateAdaptorHttpClient(restTemplate); httpClient.fetch(url); verify(restTemplate).getForObject(eq(url), eq(String.class)); }
@Override public String fetch(String url) { return restTemplate.getForObject(url, String.class); }
RestTemplateAdaptorHttpClient implements HttpClient { @Override public String fetch(String url) { return restTemplate.getForObject(url, String.class); } }
RestTemplateAdaptorHttpClient implements HttpClient { @Override public String fetch(String url) { return restTemplate.getForObject(url, String.class); } RestTemplateAdaptorHttpClient(RestTemplate restTemplate); }
RestTemplateAdaptorHttpClient implements HttpClient { @Override public String fetch(String url) { return restTemplate.getForObject(url, String.class); } RestTemplateAdaptorHttpClient(RestTemplate restTemplate); @Override String fetch(String url); }
RestTemplateAdaptorHttpClient implements HttpClient { @Override public String fetch(String url) { return restTemplate.getForObject(url, String.class); } RestTemplateAdaptorHttpClient(RestTemplate restTemplate); @Override String fetch(String url);  }