title: Junit for RESTTemplate Clients
body: <p>I am trying to write Junit for one REST Webservice Client which uses RestTemplate.</p>
  
  <p>Below is method call to <strong>REST</strong> Template:</p>
  
  <pre><code>final ResponseEntity&lt;LogDateVO[]&gt; result = restTemplate.postForEntity(url, LogDateInputVO, LogDateVO[].class);
  </code></pre>
  
  <p>In My Test Class I am trying some thing like below :</p>
  
  <pre><code>mockServer.expect(requestTo("http://abc.def.pvt:80/testOperations/api/traffic/logs/")).andExpect(method(HttpMethod.POST))
      .andRespond(MockRestResponseCreators.withSuccess("{ \"id\" : \"42\", \"name\" : \"Holiday Inn\"}", MediaType.APPLICATION_JSON));
  </code></pre>
  
  <p>I am unable to get the result back and not able to continue with this approach, i need some help in getting this. </p>
  
  <p>My intention is when my <code>restTemplate</code> is called it should check for above expect and return success with some data.</p>