public void testGeneratedDistinctId() {
    String fakeToken = UUID.randomUUID().toString();
    MixpanelAPI mixpanel =
        new TestUtils.CleanMixpanelAPI(getContext(), mMockPreferences, fakeToken);
    String generatedId1 = mixpanel.getDistinctId();
    assertTrue(generatedId1 != null);

    mixpanel.clearPreferences();
    String generatedId2 = mixpanel.getDistinctId();
    assertTrue(generatedId2 != null);
    assertTrue(generatedId1 != generatedId2);
  }
  public void testIdentifyAndGetDistinctId() {
    MixpanelAPI metrics =
        new TestUtils.CleanMixpanelAPI(getContext(), mMockPreferences, "Identify Test Token");

    String generatedId = metrics.getDistinctId();
    assertNotNull(generatedId);

    String emptyId = metrics.getPeople().getDistinctId();
    assertNull(emptyId);

    metrics.identify("Events Id");
    String setId = metrics.getDistinctId();
    assertEquals("Events Id", setId);

    String stillEmpty = metrics.getPeople().getDistinctId();
    assertNull(stillEmpty);

    metrics.getPeople().identify("People Id");
    String unchangedId = metrics.getDistinctId();
    assertEquals("Events Id", unchangedId);

    String setPeopleId = metrics.getPeople().getDistinctId();
    assertEquals("People Id", setPeopleId);
  }
 /**
  * Returns user's Distinct ID that is automatically assigned by Mixpanel.
  *
  * @param successCallback
  */
 @ReactMethod
 public void getDistinctId(Callback successCallback) {
   successCallback.invoke(mixpanel.getDistinctId());
 }
 /**
  * Alias old anonymous Id w/ new user email.
  *
  * @param newId
  */
 @ReactMethod
 public void alias(String newId) {
   mixpanel.alias(newId, mixpanel.getDistinctId());
 }