@Test public void testSendInBackgroundSuccess() throws Exception { JSONObject mockResponse = new JSONObject(); mockResponse.put("result", "OK"); ParseHttpClient restClient = mockParseHttpClientWithResponse(mockResponse, 200, "OK"); ParsePushController controller = new ParsePushController(restClient); JSONObject data = new JSONObject(); data.put(ParsePush.KEY_DATA_MESSAGE, "hello world"); ParsePush.State state = new ParsePush.State.Builder() .data(data) .build(); Task<Void> pushTask = controller.sendInBackground(state, "sessionToken"); ParseTaskUtils.wait(pushTask); verify(restClient, times(1)).execute(any(ParseHttpRequest.class)); }
public Task<Void> sendInBackground(ParsePush.State state, String sessionToken) { return buildRESTSendPushCommand(state, sessionToken).executeAsync(restClient).makeVoid(); }
ParsePushController { public Task<Void> sendInBackground(ParsePush.State state, String sessionToken) { return buildRESTSendPushCommand(state, sessionToken).executeAsync(restClient).makeVoid(); } }
ParsePushController { public Task<Void> sendInBackground(ParsePush.State state, String sessionToken) { return buildRESTSendPushCommand(state, sessionToken).executeAsync(restClient).makeVoid(); } ParsePushController(ParseHttpClient restClient); }
ParsePushController { public Task<Void> sendInBackground(ParsePush.State state, String sessionToken) { return buildRESTSendPushCommand(state, sessionToken).executeAsync(restClient).makeVoid(); } ParsePushController(ParseHttpClient restClient); Task<Void> sendInBackground(ParsePush.State state, String sessionToken); }
ParsePushController { public Task<Void> sendInBackground(ParsePush.State state, String sessionToken) { return buildRESTSendPushCommand(state, sessionToken).executeAsync(restClient).makeVoid(); } ParsePushController(ParseHttpClient restClient); Task<Void> sendInBackground(ParsePush.State state, String sessionToken);  }