@Test public void testTrackAppOpened() throws Exception { ParseEventuallyQueue queue = mock(ParseEventuallyQueue.class); when(queue.enqueueEventuallyAsync(any(ParseRESTCommand.class), any(ParseObject.class))) .thenReturn(Task.forResult(new JSONObject())); ParseAnalyticsController controller = new ParseAnalyticsController(queue); ParseTaskUtils.wait(controller.trackAppOpenedInBackground("pushHash", "sessionToken")); ArgumentCaptor<ParseRESTCommand> command = ArgumentCaptor.forClass(ParseRESTCommand.class); ArgumentCaptor<ParseObject> object = ArgumentCaptor.forClass(ParseObject.class); verify(queue, times(1)).enqueueEventuallyAsync(command.capture(), object.capture()); assertNull(object.getValue()); assertTrue(command.getValue() instanceof ParseRESTAnalyticsCommand); assertTrue(command.getValue().httpPath.contains(ParseRESTAnalyticsCommand.EVENT_APP_OPENED)); assertEquals("sessionToken", command.getValue().getSessionToken()); assertEquals("pushHash", command.getValue().jsonParameters.get("push_hash")); }
public Task<Void> trackAppOpenedInBackground(String pushHash, String sessionToken) { ParseRESTCommand command = ParseRESTAnalyticsCommand.trackAppOpenedCommand(pushHash, sessionToken); Task<JSONObject> eventuallyTask = eventuallyQueue.enqueueEventuallyAsync(command, null); return eventuallyTask.makeVoid(); }
ParseAnalyticsController { public Task<Void> trackAppOpenedInBackground(String pushHash, String sessionToken) { ParseRESTCommand command = ParseRESTAnalyticsCommand.trackAppOpenedCommand(pushHash, sessionToken); Task<JSONObject> eventuallyTask = eventuallyQueue.enqueueEventuallyAsync(command, null); return eventuallyTask.makeVoid(); } }
ParseAnalyticsController { public Task<Void> trackAppOpenedInBackground(String pushHash, String sessionToken) { ParseRESTCommand command = ParseRESTAnalyticsCommand.trackAppOpenedCommand(pushHash, sessionToken); Task<JSONObject> eventuallyTask = eventuallyQueue.enqueueEventuallyAsync(command, null); return eventuallyTask.makeVoid(); } ParseAnalyticsController(ParseEventuallyQueue eventuallyQueue); }
ParseAnalyticsController { public Task<Void> trackAppOpenedInBackground(String pushHash, String sessionToken) { ParseRESTCommand command = ParseRESTAnalyticsCommand.trackAppOpenedCommand(pushHash, sessionToken); Task<JSONObject> eventuallyTask = eventuallyQueue.enqueueEventuallyAsync(command, null); return eventuallyTask.makeVoid(); } ParseAnalyticsController(ParseEventuallyQueue eventuallyQueue); Task<Void> trackEventInBackground(final String name,
                                             Map<String, String> dimensions, String sessionToken); Task<Void> trackAppOpenedInBackground(String pushHash, String sessionToken); }
ParseAnalyticsController { public Task<Void> trackAppOpenedInBackground(String pushHash, String sessionToken) { ParseRESTCommand command = ParseRESTAnalyticsCommand.trackAppOpenedCommand(pushHash, sessionToken); Task<JSONObject> eventuallyTask = eventuallyQueue.enqueueEventuallyAsync(command, null); return eventuallyTask.makeVoid(); } ParseAnalyticsController(ParseEventuallyQueue eventuallyQueue); Task<Void> trackEventInBackground(final String name,
                                             Map<String, String> dimensions, String sessionToken); Task<Void> trackAppOpenedInBackground(String pushHash, String sessionToken);  }