ParsePush { public static Task<Void> sendMessageInBackground(String message, ParseQuery<ParseInstallation> query) { ParsePush push = new ParsePush(); push.setQuery(query); push.setMessage(message); return push.sendInBackground(); } ParsePush();  ParsePush(ParsePush push); private  ParsePush(State.Builder builder); static Task<Void> subscribeInBackground(String channel); static void subscribeInBackground(String channel, SaveCallback callback); static Task<Void> unsubscribeInBackground(String channel); static void unsubscribeInBackground(String channel, SaveCallback callback); static Task<Void> sendMessageInBackground(String message,
                                                     ParseQuery<ParseInstallation> query); static void sendMessageInBackground(String message, ParseQuery<ParseInstallation> query,
                                               SendCallback callback); static Task<Void> sendDataInBackground(JSONObject data,
                                                  ParseQuery<ParseInstallation> query); static void sendDataInBackground(JSONObject data, ParseQuery<ParseInstallation> query,
                                            SendCallback callback); void setChannel(String channel); void setChannels(Collection<String> channels); void setQuery(ParseQuery<ParseInstallation> query); void setExpirationTime(long time); void setExpirationTimeInterval(long timeInterval); void clearExpiration(); void setPushTime(long time); void setData(JSONObject data); void setMessage(String message); Task<Void> sendInBackground(); void send(); void sendInBackground(SendCallback callback);  }
@Test public void testSendMessageInBackground() throws Exception { ParsePushController controller = mock(ParsePushController.class); when(controller.sendInBackground(any(ParsePush.State.class), anyString())) .thenReturn(Task.<Void>forResult(null)); ParseCorePlugins.getInstance().registerPushController(controller); ParseQuery<ParseInstallation> query = ParseInstallation.getQuery(); query.getBuilder() .whereEqualTo("foo", "bar"); ParseTaskUtils.wait(ParsePush.sendMessageInBackground("test", query)); ArgumentCaptor<ParsePush.State> stateCaptor = ArgumentCaptor.forClass(ParsePush.State.class); verify(controller, times(1)).sendInBackground(stateCaptor.capture(), anyString()); ParsePush.State state = stateCaptor.getValue(); ParseQuery.State<ParseInstallation> queryState = state.queryState(); JSONObject queryStateJson = queryState.toJSON(PointerEncoder.get()); assertEquals("bar", queryStateJson.getJSONObject("where").getString("foo")); assertEquals("test", state.data().getString(ParsePush.KEY_DATA_MESSAGE)); }