Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. //Test Cases
  2.  
  3. Id accountId = '0016F00002AHDKV';
  4. String accountIdInString = '0016F00002AHDKV';
  5.  
  6. //Case 1 : Pass Id value to String parameter
  7. System.debug(IdMapExample.getDataUsingKeyWithString(accountId));
  8. //Result : It will work properly and return a value as passed 15 digit Id value will be converted to 18 digit format.
  9.  
  10. //Case 2 : Pass String value to String parameter
  11. System.debug(IdMapExample.getDataUsingKeyWithString(accountIdInString));
  12. //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
  13. // and will return null
  14.  
  15. //Case 3: Pass Id value to Id parameter
  16. System.debug(IdMapExample.getDataUsingKeyWithId(accountId));
  17. //Result: This will work as expected, passed 15 digit Id value will be converted to 18 digit format.
  18.  
  19. //Case 4: Pass String value to Id parameter
  20. System.debug(IdMapExample.getDataUsingKeyWithId(accountIdInString));
  21. //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