### Question:
ParseAnalytics { public static void trackEventInBackground(String name, SaveCallback callback) { ParseTaskUtils.callbackOnMainThreadAsync(trackEventInBackground(name), callback); }  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(expected = IllegalArgumentException.class) public void testTrackEventInBackgroundNullName() throws Exception { ParseTaskUtils.wait(ParseAnalytics.trackEventInBackground(null)); }
@Test(expected = IllegalArgumentException.class) public void testTrackEventInBackgroundEmptyName() throws Exception{ ParseTaskUtils.wait(ParseAnalytics.trackEventInBackground("")); }
@Test public void testTrackEventInBackgroundNormalName() throws Exception{ ParseTaskUtils.wait(ParseAnalytics.trackEventInBackground("test")); verify(controller, times(1)).trackEventInBackground( eq("test"), Matchers.<Map<String, String>>eq(null), isNull(String.class)); }
@Test public void testTrackEventInBackgroundNullParameters() throws Exception{ ParseTaskUtils.wait(ParseAnalytics.trackEventInBackground("test", (Map<String, String>) null)); verify(controller, times(1)).trackEventInBackground( eq("test"), Matchers.<Map<String, String>>eq(null), isNull(String.class)); }
@Test public void testTrackEventInBackgroundEmptyParameters() throws Exception{ Map<String, String> dimensions = new HashMap<>(); ParseTaskUtils.wait(ParseAnalytics.trackEventInBackground("test", dimensions)); verify(controller, times(1)).trackEventInBackground( eq("test"), eq(dimensions), isNull(String.class)); }
@Test public void testTrackEventInBackgroundNormalParameters() throws Exception{ Map<String, String> dimensions = new HashMap<>(); dimensions.put("key", "value"); ParseTaskUtils.wait(ParseAnalytics.trackEventInBackground("test", dimensions)); verify(controller, times(1)).trackEventInBackground( eq("test"), eq(dimensions), isNull(String.class)); }
@Test public void testTrackEventInBackgroundNullCallback() throws Exception{ Map<String, String> dimensions = new HashMap<>(); ParseAnalytics.trackEventInBackground("test", dimensions, null); verify(controller, times(1)).trackEventInBackground( eq("test"), eq(dimensions), isNull(String.class)); }
@Test public void testTrackEventInBackgroundNormalCallback() throws Exception{ final Map<String, String> dimensions = new HashMap<>(); dimensions.put("key", "value"); final Semaphore done = new Semaphore(0); ParseAnalytics.trackEventInBackground("test", dimensions, new SaveCallback() { @Override public void done(ParseException e) { assertNull(e); done.release(); } }); assertTrue(done.tryAcquire(1, 10, TimeUnit.SECONDS)); verify(controller, times(1)).trackEventInBackground( eq("test"), eq(dimensions), isNull(String.class)); final Semaphore doneAgain = new Semaphore(0); ParseAnalytics.trackEventInBackground("test", new SaveCallback() { @Override public void done(ParseException e) { assertNull(e); doneAgain.release(); } }); assertTrue(doneAgain.tryAcquire(1, 10, TimeUnit.SECONDS)); verify(controller, times(1)).trackEventInBackground (eq("test"), Matchers.<Map<String, String>>eq(null), isNull(String.class)); }