I am trying to capture an http request with Robolectric The method tokenize method sends a request to a server and I just want to test that the post is sent: If I try
//Cardtest.java
Robolectric.setDefaultHttpResponse(200, "dummy");
card.tokenize(paymentHandler);
Robolectric.getSentHttpRequest(0);
The I have an empty array error
But I know that the request is sent because if I remove the first line I have the following error:
Unexpected HTTP call POST
If I put log statement it appears that my success block is never called for an http request.
How can I make sure that my HTTP request success call back get called.
(I already try Robolectric.runUiThreadTasksIncludingDelayedTasks();)
Thanks