Source:
public void testIdentifyAfterSet() { final List<AnalyticsMessages.PeopleDescription> messages = new ArrayList<AnalyticsMessages.PeopleDescription>(); final AnalyticsMessages listener = new AnalyticsMessages(getContext()) { @Override public void peopleMessage(PeopleDescription heard) { messages.add(heard); } }; MixpanelAPI mixpanel = new TestUtils.CleanMixpanelAPI(getContext(), mMockPreferences, "TEST TOKEN testIdentifyAfterSet") { @Override protected AnalyticsMessages getAnalyticsMessages() { return listener; } @Override DecideMessages constructDecideUpdates(String token, DecideMessages.OnNewResultsListener listener, UpdatesFromMixpanel updatesFromMixpanel) { return super.constructDecideUpdates(token, listener, updatesFromMixpanel); } }; MixpanelAPI.People people = mixpanel.getPeople(); people.increment("the prop", 0L); people.append("the prop", 1); people.set("the prop", 2); people.increment("the prop", 3L); people.increment("the prop", 4); people.append("the prop", 5); people.append("the prop", 6); people.identify("Personal Identity"); assertEquals(messages.size(), 7); try { for (AnalyticsMessages.PeopleDescription message: messages) { String distinctId = message.getMessage().getString("$distinct_id"); assertEquals(distinctId, "Personal Identity"); Log.d("SERGIO", "Message " + message.getMessage().toString()); } assertTrue(messages.get(0).getMessage().has("$add")); assertTrue(messages.get(1).getMessage().has("$append")); assertTrue(messages.get(2).getMessage().has("$set")); assertTrue(messages.get(3).getMessage().has("$add")); assertTrue(messages.get(4).getMessage().has("$add")); } catch (JSONException e) { fail("Unexpected JSON error in stored messages."); } }

Target:
public void testIdentifyAfterSet() { final List<AnalyticsMessages.PeopleDescription> messages = new ArrayList<AnalyticsMessages.PeopleDescription>(); final AnalyticsMessages listener = new AnalyticsMessages(getContext()) { @Override public void peopleMessage(PeopleDescription heard) { messages.add(heard); } }; MixpanelAPI mixpanel = new TestUtils.CleanMixpanelAPI(getContext(), mMockPreferences, "TEST TOKEN testIdentifyAfterSet") { @Override protected AnalyticsMessages getAnalyticsMessages() { return listener; } @Override DecideMessages constructDecideUpdates(String token, DecideMessages.OnNewResultsListener listener, UpdatesFromMixpanel updatesFromMixpanel) { return super.constructDecideUpdates(token, listener, updatesFromMixpanel); } }; MixpanelAPI.People people = mixpanel.getPeople(); people.increment("the prop", 0L); people.append("the prop", 1); people.set("the prop", 2); people.increment("the prop", 3L); people.increment("the prop", 4); people.append("the prop", 5); people.append("the prop", 6); people.identify("Personal Identity"); assertEquals(messages.size(), 7); try { for (AnalyticsMessages.PeopleDescription message: messages) { String distinctId = message.getMessage().getString("$distinct_id"); assertEquals(distinctId, "Personal Identity"); } assertTrue(messages.get(0).getMessage().has("$add")); assertTrue(messages.get(1).getMessage().has("$append")); assertTrue(messages.get(2).getMessage().has("$set")); assertTrue(messages.get(3).getMessage().has("$add")); assertTrue(messages.get(4).getMessage().has("$add")); } catch (JSONException e) { fail("Unexpected JSON error in stored messages."); } }