Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Test Cases
- Id accountId = '0016F00002AHDKV';
- String accountIdInString = '0016F00002AHDKV';
- //Case 1 : Pass Id value to String parameter
- System.debug(IdMapExample.getDataUsingKeyWithString(accountId));
- //Result : It will work properly and return a value as passed 15 digit Id value will be converted to 18 digit format.
- //Case 2 : Pass String value to String parameter
- System.debug(IdMapExample.getDataUsingKeyWithString(accountIdInString));
- //Result : It will remain in 15 digit format but map we have created will have keys in 18 digit format and this case will fail
- // and will return null
- //Case 3: Pass Id value to Id parameter
- System.debug(IdMapExample.getDataUsingKeyWithId(accountId));
- //Result: This will work as expected, passed 15 digit Id value will be converted to 18 digit format.
- //Case 4: Pass String value to Id parameter
- System.debug(IdMapExample.getDataUsingKeyWithId(accountIdInString));
- //Result: This will work as well, passed 15 digit String value will be converted to 18 digit format.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement