Advertisement
martyychang

TestDatabase for Higher Education Salesforce Org

Oct 7th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 29.96 KB | None | 0 0
  1. /**
  2.  * Add this code inside your test class. To use it, use the following syntax
  3.  * in your test method:
  4.  *
  5.  *      TestDatabase db = new TestDatabase();
  6.  *
  7.  * Afterward you can retrieve test records using the getter methods defined
  8.  * inside the TestDatabase class.
  9.  *
  10.  * @author HardBoil
  11.  */
  12. private class TestDatabase {
  13.  
  14.     private Map<Id, Compensation_Rate__c> compensationRateMap;
  15.  
  16.     private Map<String, Compensation_Rate__c> compensationRateMapByName;
  17.  
  18.     private Map<Id, Account> accountMap;
  19.  
  20.     private Map<String, Account> accountMapByNUID;
  21.  
  22.     private Map<Id, License_Certification__c> licenseCertificationMap;
  23.  
  24.     private Map<Id, Term__c> termMap;
  25.  
  26.     private Map<String, Term__c> termMapByName;
  27.  
  28.     private Map<String, Term__c> termMapByBannerCode;
  29.  
  30.     private Map<Id, Part_of_Term__c> partofTermMap;
  31.  
  32.     private Map<String, Part_of_Term__c> partofTermMapByName;
  33.  
  34.     private Map<Id, Part_of_Term_Paydate__c> partofTermPaydateMap;
  35.  
  36.     private Map<Id, Course__c> courseMap;
  37.  
  38.     private Map<String, Course__c> courseMapByName;
  39.  
  40.     private Map<Id, Class__c> classMap;
  41.  
  42.     private Map<String, Class__c> classMapByName;
  43.  
  44.     private Map<String, Class__c> classMapByName;
  45.  
  46.     private Map<Id, Class_Meeting__c> classMeetingMap;
  47.  
  48.     private Map<Id, Contract> contractMap;
  49.  
  50.     /**
  51.      * Default constructor.
  52.      */
  53.     public TestDatabase() {
  54.        
  55.         // Create the Compensation_Rate__c records.
  56.  
  57.         List<Compensation_Rate__c> compensationRates = new List<Compensation_Rate__c> {
  58.             new Compensation_Rate__c(
  59.                     Name = 'Superhero Lecturer ($833.33/credit)',
  60.                     RecordTypeId = CompensationRateUtil.getRecordTypeId('Base Contract Pay'),
  61.                     Rate_Type__c = 'Per Credit Hour',
  62.                     Amount__c = 833.33
  63.             )
  64.         };
  65.  
  66.         insert compensationRates;
  67.  
  68.         compensationRateMap = new Map<Id, Compensation_Rate__c>(compensationRates);
  69.         compensationRateMapByName = new Map<String, Compensation_Rate__c>();
  70.  
  71.         for (Compensation_Rate__c compensationRate : compensationRates) {
  72.             compensationRateMapByName.put(compensationRate.Name, compensationRate);
  73.         }   // for (Compensation_Rate__c compensationRate : compensationRates)
  74.        
  75.         // Create the Account records.
  76.  
  77.         List<Account> accounts = new List<Account> {
  78.             new Account(
  79.                     FirstName = 'Bruce',
  80.                     LastName = 'Wayne',
  81.                     NUID__c = '800000001',
  82.                     RecordTypeId = AccountUtil.getRecordTypeId('Person Account')
  83.             ),
  84.             new Account(
  85.                     FirstName = 'Benjamin',
  86.                     LastName = 'Grimm',
  87.                     NUID__c = '800000002',
  88.                     RecordTypeId = AccountUtil.getRecordTypeId('Person Account')
  89.             )
  90.         };
  91.  
  92.         insert accounts;
  93.  
  94.         accountMap = new Map<Id, Account>(accounts);
  95.         accountMapByNUID = new Map<String, Account>();
  96.  
  97.         for (Account account : accounts) {
  98.             accountMapByNUID.put(account.NUID__c, account);
  99.         }   // for (Account account : accounts)
  100.        
  101.         // Create the License_Certification__c records.
  102.  
  103.         List<License_Certification__c> licenseCertifications = new List<License_Certification__c> {
  104.             new License_Certification__c(
  105.                     Account__c = getAccountByNUID('800000001').Id,
  106.                     Type__c = 'Certification',
  107.                     License_Certification__c = 'CPS Certified Online Instructor',
  108.                     Issued_Date__c = Date.parse('1/1/2020'),
  109.                     Expiration_Date__c = Date.parse('1/1/2021')
  110.             ),
  111.             new License_Certification__c(
  112.                     Account__c = getAccountByNUID('800000002').Id,
  113.                     Type__c = 'Certification',
  114.                     License_Certification__c = 'CPS Certified Online Instructor',
  115.                     Issued_Date__c = Date.parse('1/1/2020'),
  116.                     Expiration_Date__c = Date.parse('1/1/2021')
  117.             ),
  118.             new License_Certification__c(
  119.                     Account__c = getAccountByNUID('800000001').Id,
  120.                     Type__c = 'Certification',
  121.                     License_Certification__c = 'CPS Certified Online Instructor',
  122.                     Issued_Date__c = Date.parse('1/1/2021'),
  123.                     Expiration_Date__c = Date.parse('1/1/2022')
  124.             )
  125.         };
  126.  
  127.         insert licenseCertifications;
  128.  
  129.         licenseCertificationMap = new Map<Id, License_Certification__c>(licenseCertifications);
  130.        
  131.         // Create the Term__c records.
  132.  
  133.         List<Term__c> terms = new List<Term__c> {
  134.             new Term__c(
  135.                     Name = 'Winter 2022 CPS Quarter',
  136.                     Banner_Code__c = '202225',
  137.                     Start_Date__c = Date.parse('1/1/2022'),
  138.                     Academic_Year__c = '2022'
  139.             )
  140.         };
  141.  
  142.         insert terms;
  143.  
  144.         termMap = new Map<Id, Term__c>(terms);
  145.         termMapByName = new Map<String, Term__c>();
  146.         termMapByBannerCode = new Map<String, Term__c>();
  147.  
  148.         for (Term__c term : terms) {
  149.             termMapByName.put(term.Name, term);
  150.             termMapByBannerCode.put(term.Banner_Code__c, term);
  151.         }   // for (Term__c term : terms)
  152.        
  153.         // Create the Part_of_Term__c records.
  154.  
  155.         List<Part_of_Term__c> partofTerms = new List<Part_of_Term__c> {
  156.             new Part_of_Term__c(
  157.                     Name = 'Winter 2022, Full Term Session',
  158.                     Term__c = getTermByName('Winter 2022 CPS Quarter').Id,
  159.                     Banner_Part_of_Term_Code__c = '1',
  160.                     Short_Name__c = 'Winter 2022, Full Term Session',
  161.                     Start_Date__c = Date.parse('1/1/2022')
  162.             ),
  163.             new Part_of_Term__c(
  164.                     Name = 'Winter 2022, First Six-week Session',
  165.                     Term__c = getTermByName('Winter 2022 CPS Quarter').Id,
  166.                     Banner_Part_of_Term_Code__c = 'A',
  167.                     Short_Name__c = 'Winter 2022, First Six-week Session',
  168.                     Start_Date__c = Date.parse('1/1/2022')
  169.             ),
  170.             new Part_of_Term__c(
  171.                     Name = 'Winter 2022, Second Six-week Session',
  172.                     Term__c = getTermByName('Winter 2022 CPS Quarter').Id,
  173.                     Banner_Part_of_Term_Code__c = 'B',
  174.                     Short_Name__c = 'Winter 2022, Second Six-week Session',
  175.                     Start_Date__c = Date.parse('3/1/2022')
  176.             )
  177.         };
  178.  
  179.         insert partofTerms;
  180.  
  181.         partofTermMap = new Map<Id, Part_of_Term__c>(partofTerms);
  182.         partofTermMapByName = new Map<String, Part_of_Term__c>();
  183.  
  184.         for (Part_of_Term__c partofTerm : partofTerms) {
  185.             partofTermMapByName.put(partofTerm.Name, partofTerm);
  186.         }   // for (Part_of_Term__c partofTerm : partofTerms)
  187.        
  188.         // Create the Part_of_Term_Paydate__c records.
  189.  
  190.         List<Part_of_Term_Paydate__c> partofTermPaydates = new List<Part_of_Term_Paydate__c> {
  191.             new Part_of_Term_Paydate__c(
  192.                     Part_of_Term__c = getPartofTermByName('Winter 2022, First Six-week Session').Id,
  193.                     Pay_Start_Date__c = Date.parse('2/1/2022'),
  194.                     Pay_End_Date__c = Date.parse('2/28/2022'),
  195.                     Pay_Check_Date__c = Date.parse('2/28/2022'),
  196.                     Last_Paydate__c = true,
  197.                     Available_to_Pay__c = true
  198.             ),
  199.             new Part_of_Term_Paydate__c(
  200.                     Part_of_Term__c = getPartofTermByName('Winter 2022, First Six-week Session').Id,
  201.                     Pay_Start_Date__c = Date.parse('1/1/2022'),
  202.                     Pay_End_Date__c = Date.parse('1/31/2022'),
  203.                     Pay_Check_Date__c = Date.parse('1/31/2022'),
  204.                     Last_Paydate__c = false,
  205.                     Available_to_Pay__c = true
  206.             ),
  207.             new Part_of_Term_Paydate__c(
  208.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  209.                     Pay_Start_Date__c = Date.parse('2/1/2022'),
  210.                     Pay_End_Date__c = Date.parse('2/28/2022'),
  211.                     Pay_Check_Date__c = Date.parse('2/28/2022'),
  212.                     Last_Paydate__c = false,
  213.                     Available_to_Pay__c = true
  214.             ),
  215.             new Part_of_Term_Paydate__c(
  216.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  217.                     Pay_Start_Date__c = Date.parse('1/1/2022'),
  218.                     Pay_End_Date__c = Date.parse('1/31/2022'),
  219.                     Pay_Check_Date__c = Date.parse('1/31/2022'),
  220.                     Last_Paydate__c = false,
  221.                     Available_to_Pay__c = true
  222.             ),
  223.             new Part_of_Term_Paydate__c(
  224.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  225.                     Pay_Start_Date__c = Date.parse('3/1/2022'),
  226.                     Pay_End_Date__c = Date.parse('3/31/2022'),
  227.                     Pay_Check_Date__c = Date.parse('3/30/2022'),
  228.                     Last_Paydate__c = false,
  229.                     Available_to_Pay__c = true
  230.             ),
  231.             new Part_of_Term_Paydate__c(
  232.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  233.                     Pay_Start_Date__c = Date.parse('4/1/2022'),
  234.                     Pay_End_Date__c = Date.parse('4/30/2022'),
  235.                     Pay_Check_Date__c = Date.parse('4/30/2022'),
  236.                     Last_Paydate__c = true,
  237.                     Available_to_Pay__c = true
  238.             ),
  239.             new Part_of_Term_Paydate__c(
  240.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Second Six-week Session').Id,
  241.                     Pay_Start_Date__c = Date.parse('3/1/2022'),
  242.                     Pay_End_Date__c = Date.parse('3/31/2022'),
  243.                     Pay_Check_Date__c = Date.parse('3/30/2022'),
  244.                     Last_Paydate__c = false,
  245.                     Available_to_Pay__c = true
  246.             ),
  247.             new Part_of_Term_Paydate__c(
  248.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Second Six-week Session').Id,
  249.                     Pay_Start_Date__c = Date.parse('4/1/2022'),
  250.                     Pay_End_Date__c = Date.parse('4/30/2022'),
  251.                     Pay_Check_Date__c = Date.parse('4/22/2022'),
  252.                     Last_Paydate__c = true,
  253.                     Available_to_Pay__c = true
  254.             )
  255.         };
  256.  
  257.         insert partofTermPaydates;
  258.  
  259.         partofTermPaydateMap = new Map<Id, Part_of_Term_Paydate__c>(partofTermPaydates);
  260.        
  261.         // Create the Course__c records.
  262.  
  263.         List<Course__c> courses = new List<Course__c> {
  264.             new Course__c(
  265.                     Name = 'DCC1001',
  266.                     RecordTypeId = CourseUtil.getRecordTypeId('Banner Course'),
  267.                     Title__c = 'Introduction to DC Comics',
  268.                     Status__c = 'A'
  269.             )
  270.         };
  271.  
  272.         insert courses;
  273.  
  274.         courseMap = new Map<Id, Course__c>(courses);
  275.         courseMapByName = new Map<String, Course__c>();
  276.  
  277.         for (Course__c course : courses) {
  278.             courseMapByName.put(course.Name, course);
  279.         }   // for (Course__c course : courses)
  280.        
  281.         // Create the Class__c records.
  282.  
  283.         List<Class__c> classes = new List<Class__c> {
  284.             new Class__c(
  285.                     Name = '202215-80001',
  286.                     CRN__c = '80001',
  287.                     Course__c = getCourseByName('DCC1001').Id,
  288.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  289.                     Credit_Hours__c = 3,
  290.                     Actual_Enrollment__c = 1,
  291.                     Banner_Instructional_Method_Code__c = 'TR',
  292.                     Status__c = 'A'
  293.             ),
  294.             new Class__c(
  295.                     Name = '202215-80002',
  296.                     CRN__c = '80002',
  297.                     Course__c = getCourseByName('DCC1001').Id,
  298.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  299.                     Credit_Hours__c = 3,
  300.                     Actual_Enrollment__c = 1,
  301.                     Banner_Instructional_Method_Code__c = 'TR',
  302.                     Status__c = 'A'
  303.             ),
  304.             new Class__c(
  305.                     Name = '202215-80003',
  306.                     CRN__c = '80003',
  307.                     Course__c = getCourseByName('DCC1001').Id,
  308.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  309.                     Credit_Hours__c = 3,
  310.                     Actual_Enrollment__c = 2,
  311.                     Banner_Instructional_Method_Code__c = 'BL',
  312.                     Status__c = 'A'
  313.             ),
  314.             new Class__c(
  315.                     Name = '202215-80004',
  316.                     CRN__c = '80004',
  317.                     Course__c = getCourseByName('DCC1001').Id,
  318.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  319.                     Credit_Hours__c = 3,
  320.                     Actual_Enrollment__c = 3,
  321.                     Banner_Instructional_Method_Code__c = 'TR',
  322.                     Status__c = 'A'
  323.             ),
  324.             new Class__c(
  325.                     Name = '202215-80005',
  326.                     CRN__c = '80005',
  327.                     Course__c = getCourseByName('DCC1001').Id,
  328.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  329.                     Credit_Hours__c = 3,
  330.                     Actual_Enrollment__c = 4,
  331.                     Banner_Instructional_Method_Code__c = 'HY',
  332.                     Status__c = 'A'
  333.             ),
  334.             new Class__c(
  335.                     Name = '202215-80006',
  336.                     CRN__c = '80006',
  337.                     Course__c = getCourseByName('DCC1001').Id,
  338.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  339.                     Credit_Hours__c = 3,
  340.                     Actual_Enrollment__c = 5,
  341.                     Banner_Instructional_Method_Code__c = 'TR',
  342.                     Status__c = 'A'
  343.             ),
  344.             new Class__c(
  345.                     Name = '202215-80007',
  346.                     CRN__c = '80007',
  347.                     Course__c = getCourseByName('DCC1001').Id,
  348.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  349.                     Credit_Hours__c = 3,
  350.                     Actual_Enrollment__c = 6,
  351.                     Banner_Instructional_Method_Code__c = 'TR',
  352.                     Status__c = 'A'
  353.             ),
  354.             new Class__c(
  355.                     Name = '202215-80008',
  356.                     CRN__c = '80008',
  357.                     Course__c = getCourseByName('DCC1001').Id,
  358.                     Part_of_Term__c = getPartofTermByName('Winter 2022, Full Term Session').Id,
  359.                     Credit_Hours__c = 3,
  360.                     Actual_Enrollment__c = 7,
  361.                     Banner_Instructional_Method_Code__c = 'BL',
  362.                     Status__c = 'A'
  363.             )
  364.         };
  365.  
  366.         insert classes;
  367.  
  368.         classMap = new Map<Id, Class__c>(classes);
  369.         classMapByName = new Map<String, Class__c>();
  370.         classMapByName = new Map<String, Class__c>();
  371.  
  372.         for (Class__c class_x : classes) {
  373.             classMapByName.put(class_x.Name, class_x);
  374.             classMapByName.put(class.Name, class);
  375.         }   // for (Class__c class_x : classes)
  376.        
  377.         // Create the Class_Meeting__c records.
  378.  
  379.         List<Class_Meeting__c> classMeetings = new List<Class_Meeting__c> {
  380.             new Class_Meeting__c(
  381.                     Class_ID__c = getClassByName('202215-80001').Id,
  382.                     Start_Date__c = Date.parse('1/19/2022'),
  383.                     End_Date__c = Date.parse('1/19/2022'),
  384.                     Start_Time__c = '1330',
  385.                     End_Time__c = '1530',
  386.                     Monday__c = '',
  387.                     Tuesday__c = '',
  388.                     Wednesday__c = '',
  389.                     Thursday__c = 'R',
  390.                     Friday__c = '',
  391.                     Saturday__c = '',
  392.                     Sunday__c = ''
  393.             ),
  394.             new Class_Meeting__c(
  395.                     Class_ID__c = getClassByName('202215-80001').Id,
  396.                     Start_Date__c = Date.parse('1/20/2022'),
  397.                     End_Date__c = Date.parse('1/20/2022'),
  398.                     Start_Time__c = '1330',
  399.                     End_Time__c = '1530',
  400.                     Monday__c = '',
  401.                     Tuesday__c = '',
  402.                     Wednesday__c = '',
  403.                     Thursday__c = 'R',
  404.                     Friday__c = '',
  405.                     Saturday__c = '',
  406.                     Sunday__c = ''
  407.             ),
  408.             new Class_Meeting__c(
  409.                     Class_ID__c = getClassByName('202215-80001').Id,
  410.                     Start_Date__c = Date.parse('2/2/2022'),
  411.                     End_Date__c = Date.parse('2/2/2022'),
  412.                     Start_Time__c = '1330',
  413.                     End_Time__c = '1530',
  414.                     Monday__c = '',
  415.                     Tuesday__c = '',
  416.                     Wednesday__c = '',
  417.                     Thursday__c = 'R',
  418.                     Friday__c = '',
  419.                     Saturday__c = '',
  420.                     Sunday__c = ''
  421.             ),
  422.             new Class_Meeting__c(
  423.                     Class_ID__c = getClassByName('202215-80001').Id,
  424.                     Start_Date__c = Date.parse('2/27/2022'),
  425.                     End_Date__c = Date.parse('2/27/2022'),
  426.                     Start_Time__c = '1330',
  427.                     End_Time__c = '1530',
  428.                     Monday__c = '',
  429.                     Tuesday__c = '',
  430.                     Wednesday__c = '',
  431.                     Thursday__c = 'R',
  432.                     Friday__c = '',
  433.                     Saturday__c = '',
  434.                     Sunday__c = ''
  435.             ),
  436.             new Class_Meeting__c(
  437.                     Class_ID__c = getClassByName('202215-80001').Id,
  438.                     Start_Date__c = Date.parse('3/11/2022'),
  439.                     End_Date__c = Date.parse('3/11/2022'),
  440.                     Start_Time__c = '1330',
  441.                     End_Time__c = '1530',
  442.                     Monday__c = '',
  443.                     Tuesday__c = '',
  444.                     Wednesday__c = '',
  445.                     Thursday__c = 'R',
  446.                     Friday__c = '',
  447.                     Saturday__c = '',
  448.                     Sunday__c = ''
  449.             ),
  450.             new Class_Meeting__c(
  451.                     Class_ID__c = getClassByName('202215-80001').Id,
  452.                     Start_Date__c = Date.parse('3/15/2022'),
  453.                     End_Date__c = Date.parse('3/15/2022'),
  454.                     Start_Time__c = '1330',
  455.                     End_Time__c = '1530',
  456.                     Monday__c = '',
  457.                     Tuesday__c = '',
  458.                     Wednesday__c = '',
  459.                     Thursday__c = 'R',
  460.                     Friday__c = '',
  461.                     Saturday__c = '',
  462.                     Sunday__c = ''
  463.             ),
  464.             new Class_Meeting__c(
  465.                     Class_ID__c = getClassByName('202215-80002').Id,
  466.                     Start_Date__c = Date.parse('1/9/2022'),
  467.                     End_Date__c = Date.parse('4/19/2022'),
  468.                     Start_Time__c = '0830',
  469.                     End_Time__c = '1030',
  470.                     Monday__c = 'M',
  471.                     Tuesday__c = '',
  472.                     Wednesday__c = '',
  473.                     Thursday__c = '',
  474.                     Friday__c = '',
  475.                     Saturday__c = '',
  476.                     Sunday__c = ''
  477.             ),
  478.             new Class_Meeting__c(
  479.                     Class_ID__c = getClassByName('202215-80003').Id,
  480.                     Start_Date__c = Date.parse('1/9/2022'),
  481.                     End_Date__c = Date.parse('4/19/2022'),
  482.                     Start_Time__c = '1130',
  483.                     End_Time__c = '1400',
  484.                     Monday__c = 'M',
  485.                     Tuesday__c = '',
  486.                     Wednesday__c = 'W',
  487.                     Thursday__c = '',
  488.                     Friday__c = 'F',
  489.                     Saturday__c = '',
  490.                     Sunday__c = ''
  491.             ),
  492.             new Class_Meeting__c(
  493.                     Class_ID__c = getClassByName('202215-80004').Id,
  494.                     Start_Date__c = Date.parse('1/9/2022'),
  495.                     End_Date__c = Date.parse('4/19/2022'),
  496.                     Start_Time__c = '1400',
  497.                     End_Time__c = '1600',
  498.                     Monday__c = '',
  499.                     Tuesday__c = '',
  500.                     Wednesday__c = '',
  501.                     Thursday__c = '',
  502.                     Friday__c = '',
  503.                     Saturday__c = '',
  504.                     Sunday__c = 'U'
  505.             ),
  506.             new Class_Meeting__c(
  507.                     Class_ID__c = getClassByName('202215-80004').Id,
  508.                     Start_Date__c = Date.parse('1/9/2022'),
  509.                     End_Date__c = Date.parse('1/9/2022'),
  510.                     Start_Time__c = '1300',
  511.                     End_Time__c = '1500',
  512.                     Monday__c = '',
  513.                     Tuesday__c = 'T',
  514.                     Wednesday__c = '',
  515.                     Thursday__c = '',
  516.                     Friday__c = '',
  517.                     Saturday__c = '',
  518.                     Sunday__c = ''
  519.             ),
  520.             new Class_Meeting__c(
  521.                     Class_ID__c = getClassByName('202215-80004').Id,
  522.                     Start_Date__c = Date.parse('1/28/2022'),
  523.                     End_Date__c = Date.parse('1/28/2022'),
  524.                     Start_Time__c = '1300',
  525.                     End_Time__c = '1500',
  526.                     Monday__c = '',
  527.                     Tuesday__c = 'T',
  528.                     Wednesday__c = '',
  529.                     Thursday__c = '',
  530.                     Friday__c = '',
  531.                     Saturday__c = '',
  532.                     Sunday__c = ''
  533.             ),
  534.             new Class_Meeting__c(
  535.                     Class_ID__c = getClassByName('202215-80004').Id,
  536.                     Start_Date__c = Date.parse('2/9/2022'),
  537.                     End_Date__c = Date.parse('2/9/2022'),
  538.                     Start_Time__c = '1300',
  539.                     End_Time__c = '1500',
  540.                     Monday__c = '',
  541.                     Tuesday__c = '',
  542.                     Wednesday__c = '',
  543.                     Thursday__c = '',
  544.                     Friday__c = '',
  545.                     Saturday__c = 'S',
  546.                     Sunday__c = ''
  547.             ),
  548.             new Class_Meeting__c(
  549.                     Class_ID__c = getClassByName('202215-80004').Id,
  550.                     Start_Date__c = Date.parse('2/19/2022'),
  551.                     End_Date__c = Date.parse('2/19/2022'),
  552.                     Start_Time__c = '1300',
  553.                     End_Time__c = '1500',
  554.                     Monday__c = '',
  555.                     Tuesday__c = '',
  556.                     Wednesday__c = '',
  557.                     Thursday__c = '',
  558.                     Friday__c = '',
  559.                     Saturday__c = 'S',
  560.                     Sunday__c = ''
  561.             ),
  562.             new Class_Meeting__c(
  563.                     Class_ID__c = getClassByName('202215-80005').Id,
  564.                     Start_Date__c = Date.parse('1/9/2022'),
  565.                     End_Date__c = Date.parse('4/19/2022'),
  566.                     Start_Time__c = '',
  567.                     End_Time__c = '',
  568.                     Monday__c = '',
  569.                     Tuesday__c = '',
  570.                     Wednesday__c = '',
  571.                     Thursday__c = '',
  572.                     Friday__c = '',
  573.                     Saturday__c = '',
  574.                     Sunday__c = ''
  575.             ),
  576.             new Class_Meeting__c(
  577.                     Class_ID__c = getClassByName('202215-80006').Id,
  578.                     Start_Date__c = Date.parse('1/9/2022'),
  579.                     End_Date__c = Date.parse('4/19/2022'),
  580.                     Start_Time__c = '0400',
  581.                     End_Time__c = '0550',
  582.                     Monday__c = '',
  583.                     Tuesday__c = '',
  584.                     Wednesday__c = '',
  585.                     Thursday__c = '',
  586.                     Friday__c = '',
  587.                     Saturday__c = '',
  588.                     Sunday__c = ''
  589.             ),
  590.             new Class_Meeting__c(
  591.                     Class_ID__c = getClassByName('202215-80007').Id,
  592.                     Start_Date__c = Date.parse('1/9/2022'),
  593.                     End_Date__c = Date.parse('4/19/2022'),
  594.                     Start_Time__c = '0930',
  595.                     End_Time__c = '1200',
  596.                     Monday__c = 'M',
  597.                     Tuesday__c = 'T',
  598.                     Wednesday__c = '',
  599.                     Thursday__c = '',
  600.                     Friday__c = '',
  601.                     Saturday__c = '',
  602.                     Sunday__c = ''
  603.             ),
  604.             new Class_Meeting__c(
  605.                     Class_ID__c = getClassByName('202215-80007').Id,
  606.                     Start_Date__c = Date.parse('1/9/2022'),
  607.                     End_Date__c = Date.parse('4/19/2022'),
  608.                     Start_Time__c = '0930',
  609.                     End_Time__c = '1200',
  610.                     Monday__c = '',
  611.                     Tuesday__c = '',
  612.                     Wednesday__c = 'W',
  613.                     Thursday__c = '',
  614.                     Friday__c = '',
  615.                     Saturday__c = '',
  616.                     Sunday__c = 'U'
  617.             ),
  618.             new Class_Meeting__c(
  619.                     Class_ID__c = getClassByName('202215-80007').Id,
  620.                     Start_Date__c = Date.parse('1/9/2022'),
  621.                     End_Date__c = Date.parse('4/19/2022'),
  622.                     Start_Time__c = '0930',
  623.                     End_Time__c = '1200',
  624.                     Monday__c = '',
  625.                     Tuesday__c = '',
  626.                     Wednesday__c = '',
  627.                     Thursday__c = '',
  628.                     Friday__c = 'F',
  629.                     Saturday__c = '',
  630.                     Sunday__c = ''
  631.             )
  632.         };
  633.  
  634.         insert classMeetings;
  635.  
  636.         classMeetingMap = new Map<Id, Class_Meeting__c>(classMeetings);
  637.        
  638.         // Create the Contract records.
  639.  
  640.         List<Contract> contracts = new List<Contract> {
  641.             new Contract(
  642.                     AccountID = getAccountByNUID('800000001').Id,
  643.                     Status = 'Draft',
  644.                     Academic_Year__c = '2021-2022',
  645.                     RecordTypeId = ContractUtil.getRecordTypeId('Faculty Appointment Letter')
  646.             ),
  647.             new Contract(
  648.                     AccountID = getAccountByNUID('800000002').Id,
  649.                     Status = 'Draft',
  650.                     Academic_Year__c = '2021-2022',
  651.                     RecordTypeId = ContractUtil.getRecordTypeId('Faculty Appointment Letter')
  652.             )
  653.         };
  654.  
  655.         insert contracts;
  656.  
  657.         contractMap = new Map<Id, Contract>(contracts);
  658.     }   // public TestDatabase()
  659.    
  660.     public Compensation_Rate__c getCompensationRate(Id key) {
  661.         return compensationRateMap.get(key);
  662.     }   // public Compensation_Rate__c getCompensationRate(Id)
  663.    
  664.     public Compensation_Rate__c getCompensationRateByName(String key) {
  665.         return compensationRateMapByName.get(key);
  666.     }   // public Compensation_Rate__c getCompensationRateByName(String)
  667.    
  668.     public Account getAccount(Id key) {
  669.         return accountMap.get(key);
  670.     }   // public Account getAccount(Id)
  671.    
  672.     public Account getAccountByNUID(String key) {
  673.         return accountMapByNUID.get(key);
  674.     }   // public Account getAccountByNUID(String)
  675.    
  676.     public License_Certification__c getLicenseCertification(Id key) {
  677.         return licenseCertificationMap.get(key);
  678.     }   // public License_Certification__c getLicenseCertification(Id)
  679.    
  680.     public Term__c getTerm(Id key) {
  681.         return termMap.get(key);
  682.     }   // public Term__c getTerm(Id)
  683.    
  684.     public Term__c getTermByName(String key) {
  685.         return termMapByName.get(key);
  686.     }   // public Term__c getTermByName(String)
  687.    
  688.     public Term__c getTermByBannerCode(String key) {
  689.         return termMapByBannerCode.get(key);
  690.     }   // public Term__c getTermByBannerCode(String)
  691.    
  692.     public Part_of_Term__c getPartofTerm(Id key) {
  693.         return partofTermMap.get(key);
  694.     }   // public Part_of_Term__c getPartofTerm(Id)
  695.    
  696.     public Part_of_Term__c getPartofTermByName(String key) {
  697.         return partofTermMapByName.get(key);
  698.     }   // public Part_of_Term__c getPartofTermByName(String)
  699.    
  700.     public Part_of_Term_Paydate__c getPartofTermPaydate(Id key) {
  701.         return partofTermPaydateMap.get(key);
  702.     }   // public Part_of_Term_Paydate__c getPartofTermPaydate(Id)
  703.    
  704.     public Course__c getCourse(Id key) {
  705.         return courseMap.get(key);
  706.     }   // public Course__c getCourse(Id)
  707.    
  708.     public Course__c getCourseByName(String key) {
  709.         return courseMapByName.get(key);
  710.     }   // public Course__c getCourseByName(String)
  711.    
  712.     public Class__c getClass(Id key) {
  713.         return classMap.get(key);
  714.     }   // public Class__c getClass(Id)
  715.    
  716.     public Class__c getClassByName(String key) {
  717.         return classMapByName.get(key);
  718.     }   // public Class__c getClassByName(String)
  719.    
  720.     public Class__c getClassByName(String key) {
  721.         return classMapByName.get(key);
  722.     }   // public Class__c getClassByName(String)
  723.    
  724.     public Class_Meeting__c getClassMeeting(Id key) {
  725.         return classMeetingMap.get(key);
  726.     }   // public Class_Meeting__c getClassMeeting(Id)
  727.    
  728.     public Contract getContract(Id key) {
  729.         return contractMap.get(key);
  730.     }   // public Contract getContract(Id)
  731. }   // private class TestDatabase
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement