嗨有以下测试,我不能让它工作:
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));
}
我如何准备我的(Markup.class)帖子,以便稍后进行测试。
非常感谢。致以最诚挚的问候。