Skip to content

Conversation

evelyn-fyi
Copy link

When mocking an Id in Apex, such that:

    public static Id getMockId(SObjectType sObjType) {
        idsGenerated++;
        String keyPrefix = sObjType.getDescribe().getKeyPrefix();
        String idsGenStr = String.valueOf(idsGenerated);

        return Id.valueOf(keyPrefix + idsGenStr.leftPad(13-idsGenStr.length(), '0'));
    }

...the following Assert passes, although it should not:

Assert.areNotEqual(EmailMessages.getFormattedThreadingToken(mockId), EmailMessages.getFormattedThreadingToken(mockId), 'these should be the same, but they aren't');

One would expect this to remain constant. The documentation for getFormattedThreadingToken(recordId) states that the threading token should be the same for a given caseId so that all emails will be associated to that case, eg, "In this sample, we send an email with a threading token so that the email and any responses are associated with the related case."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant