title: How to test POST method using Mockito
body: <p>HI have the following test and I cannot make it work:</p>
  
  <pre><code>protected HttpClient mHttpClientMock;
  protected HttpPost mHttpPostMock;
  protected HttpResponse mHttpResponseMock;
  protected StatusLine mStatusLineMock;
  protected HttpEntity mHttpEntityMock;
  protected ContentResolver mResolver;
  
      protected void setUp() throws Exception {
      super.setUp();
      // Create mocks.
      mHttpPostMock = Mockito.mock(HttpPost.class);
      mHttpClientMock = Mockito.mock(HttpClient.class);
      mHttpResponseMock = Mockito.mock(HttpResponse.class);
      mStatusLineMock = Mockito.mock(StatusLine.class);
      mHttpEntityMock = Mockito.mock(HttpEntity.class);
  
      prepareMocks();
  
      // Obtain Content Resolver.
      mResolver = getContext().getContentResolver();
  }
  
  
  protected void prepareMocks() throws IOException {
      // Create mocked response.
      // Define expected calls.
      Mockito.when(mHttpClientMock.execute(Mockito.isA(HttpPost.class)));
  //Mockito.when(mHttpResponseMock.getStatusLine()).thenReturn(mStatusLineMock);
  //  Mockito.when(mStatusLineMock.getStatusCode()).thenReturn(HttpStatus.SC_OK);
  //  Mockito.when(mHttpResponseMock.getEntity()).thenReturn(mHttpEntityMock);
      Mockito.when(mHttpClientMock.execute(Mockito.mock(Markup.class)));
   //  Mockito.when(mHttpEntityMock.writeTo(Mockito.mock(Markup.class));
  }
  </code></pre>
  
  <p>How do I prepare my (Markup.class) Post, so I can test it later on.</p>
  
  <p>Thank you very much
  Best Regards.</p>