Skip to content

Instantly share code, notes, and snippets.

@nocrates
Created February 11, 2016 07:51
Show Gist options
  • Select an option

  • Save nocrates/5f8748b6ea6cdbba37a6 to your computer and use it in GitHub Desktop.

Select an option

Save nocrates/5f8748b6ea6cdbba37a6 to your computer and use it in GitHub Desktop.
/*
* RecordTypeAccessor_Test
*
* Test method and example usage of https://gist.github.com/nocrates/07342092bcac673b62e8
*
* (c) Appirio 2013
*/
@isTest
public class RecordTypeAccessor_Test {
public static testmethod void testOne() {
RecordType rt = RecordTypeAccessor.getRecordTypeByName('Account','Person Account');
system.assert(rt.id != null,
'Expected RecordType to be found for Account.Person Account, instead found null');
}
public static testmethod void testTwo() {
RecordType rt1 = RecordTypeAccessor.getRecordTypeByName('Account','Person Account');
RecordType rt2 = RecordTypeAccessor.getRecordTypeByName('Account','Person Account');
system.assert(rt1.id != null && rt1.id == rt2.id,
'Expected to retrieve the same id when querying for same record type twice, instead received ' +
rt1.id + ' and ' + rt2.id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment