@Test public void testBuildRESTSendPushCommandWithPushTime() throws Exception { ParseHttpClient restClient = mock(ParseHttpClient.class); ParsePushController controller = new ParsePushController(restClient); JSONObject data = new JSONObject(); data.put(ParsePush.KEY_DATA_MESSAGE, "hello world"); long pushTime = System.currentTimeMillis() / 1000 + 1000; ParsePush.State state = new ParsePush.State.Builder() .data(data) .pushTime(pushTime) .build(); ParseRESTCommand pushCommand = controller.buildRESTSendPushCommand(state, "sessionToken"); JSONObject jsonParameters = pushCommand.jsonParameters; assertFalse(jsonParameters.has(ParseRESTPushCommand.KEY_EXPIRATION_TIME)); assertFalse(jsonParameters.has(ParseRESTPushCommand.KEY_EXPIRATION_INTERVAL)); assertFalse(jsonParameters.has(ParseRESTPushCommand.KEY_CHANNELS)); assertEquals("{}", jsonParameters.get(ParseRESTPushCommand.KEY_WHERE).toString()); assertEquals("hello world", jsonParameters.getJSONObject(ParseRESTPushCommand.KEY_DATA) .getString(ParsePush.KEY_DATA_MESSAGE)); assertEquals(pushTime, jsonParameters.getLong(ParseRESTPushCommand.KEY_PUSH_TIME)); }
ParseRESTCommand buildRESTSendPushCommand(ParsePush.State state, String sessionToken) { return ParseRESTPushCommand.sendPushCommand(state.queryState(), state.channelSet(), state.expirationTime(), state.expirationTimeInterval(), state.pushTime(), state.data(), sessionToken); }
ParsePushController { ParseRESTCommand buildRESTSendPushCommand(ParsePush.State state, String sessionToken) { return ParseRESTPushCommand.sendPushCommand(state.queryState(), state.channelSet(), state.expirationTime(), state.expirationTimeInterval(), state.pushTime(), state.data(), sessionToken); } }
ParsePushController { ParseRESTCommand buildRESTSendPushCommand(ParsePush.State state, String sessionToken) { return ParseRESTPushCommand.sendPushCommand(state.queryState(), state.channelSet(), state.expirationTime(), state.expirationTimeInterval(), state.pushTime(), state.data(), sessionToken); } ParsePushController(ParseHttpClient restClient); }
ParsePushController { ParseRESTCommand buildRESTSendPushCommand(ParsePush.State state, String sessionToken) { return ParseRESTPushCommand.sendPushCommand(state.queryState(), state.channelSet(), state.expirationTime(), state.expirationTimeInterval(), state.pushTime(), state.data(), sessionToken); } ParsePushController(ParseHttpClient restClient); Task<Void> sendInBackground(ParsePush.State state, String sessionToken); }
ParsePushController { ParseRESTCommand buildRESTSendPushCommand(ParsePush.State state, String sessionToken) { return ParseRESTPushCommand.sendPushCommand(state.queryState(), state.channelSet(), state.expirationTime(), state.expirationTimeInterval(), state.pushTime(), state.data(), sessionToken); } ParsePushController(ParseHttpClient restClient); Task<Void> sendInBackground(ParsePush.State state, String sessionToken);  }