### Question:
ParseAnalytics { public static Task<Void> trackAppOpenedInBackground(Intent intent) { String pushHashStr = getPushHashFromIntent(intent); final Capture<String> pushHash = new Capture<>(); if (pushHashStr != null && pushHashStr.length() > 0) { synchronized (lruSeenPushes) { if (lruSeenPushes.containsKey(pushHashStr)) { return Task.forResult(null); } else { lruSeenPushes.put(pushHashStr, true); pushHash.set(pushHashStr); } } } return ParseUser.getCurrentSessionTokenAsync().onSuccessTask(new Continuation<String, Task<Void>>() { @Override public Task<Void> then(Task<String> task) throws Exception { String sessionToken = task.getResult(); return getAnalyticsController().trackAppOpenedInBackground(pushHash.get(), sessionToken); } }); }  static Task<Void> trackAppOpenedInBackground(Intent intent); @Deprecated static void trackAppOpened(Intent intent); static void trackAppOpenedInBackground(Intent intent, SaveCallback callback); @Deprecated static void trackEvent(String name); static void trackEventInBackground(String name, SaveCallback callback); @Deprecated static void trackEvent(String name, Map<String, String> dimensions); static void trackEventInBackground(String name, Map<String, String> dimensions, SaveCallback callback); static Task<Void> trackEventInBackground(String name); static Task<Void> trackEventInBackground(final String name,
      Map<String, String> dimensions);  }### Answer:
@Test public void testTrackAppOpenedInBackgroundNullIntent() throws Exception { ParseTaskUtils.wait(ParseAnalytics.trackAppOpenedInBackground(null)); verify(controller, times(1)).trackAppOpenedInBackground(isNull(String.class), isNull(String.class)); }
@Test public void testTrackAppOpenedInBackgroundEmptyIntent() throws Exception { Intent intent = new Intent(); ParseTaskUtils.wait(ParseAnalytics.trackAppOpenedInBackground(intent)); verify(controller, times(1)).trackAppOpenedInBackground(isNull(String.class), isNull(String.class)); }
@Test public void testTrackAppOpenedInBackgroundNormalIntent() throws Exception { Intent intent = makeIntentWithParseData("test"); ParseTaskUtils.wait(ParseAnalytics.trackAppOpenedInBackground(intent)); verify(controller, times(1)).trackAppOpenedInBackground(eq("test"), isNull(String.class)); }
@Test public void testTrackAppOpenedInBackgroundDuplicatedIntent() throws Exception { Intent intent = makeIntentWithParseData("test"); ParseTaskUtils.wait(ParseAnalytics.trackAppOpenedInBackground(intent)); verify(controller, times(1)).trackAppOpenedInBackground(eq("test"), isNull(String.class)); ParseTaskUtils.wait(ParseAnalytics.trackAppOpenedInBackground(intent)); verify(controller, times(1)).trackAppOpenedInBackground(eq("test"), isNull(String.class)); }
@Test public void testTrackAppOpenedInBackgroundNullCallback() throws Exception { Intent intent = makeIntentWithParseData("test"); ParseAnalytics.trackAppOpenedInBackground(intent, null); verify(controller, times(1)).trackAppOpenedInBackground(eq("test"), isNull(String.class)); }
@Test public void testTrackAppOpenedInBackgroundNormalCallback() throws Exception { Intent intent = makeIntentWithParseData("test"); final Semaphore done = new Semaphore(0); ParseAnalytics.trackAppOpenedInBackground(intent, new SaveCallback() { @Override public void done(ParseException e) { assertNull(e); done.release(); } }); assertTrue(done.tryAcquire(1, 10, TimeUnit.SECONDS)); verify(controller, times(1)).trackAppOpenedInBackground(eq("test"), isNull(String.class)); }