I'm trying to put a deployment into one of our instances and am getting the above error when the Apex Class Test is running. I can't work out for the life of me why it's not working, but suspect that it may be something to do with the fact that the Apex code can't create the payment schedule on the ID listed in the test.
Here's the line of code it's erroring on:
Integer numberPayments = 10; asp04__PaymentSchedule__c schedule = [SELECT Id FROM asp04__PaymentSchedule__c LIMIT 1]; List<asp04__Payment__c> payments = new List<asp04__Payment__c>(); Decimal amount = 10; String currencyCode = 'GBP'; Date paymentDate = Date.newInstance(2021, 1, 31);
The same error occurs with the below code block in the same test (the test has failed twice):
asp04__PaymentSchedule__c schedule = [SELECT Id FROM asp04__PaymentSchedule__c LIMIT 1]; asp04__Payment__c payment = TestSuiteAsperatoFactory.CreatePayment(false, schedule.Id, 10, 'GBP', Date.newInstance(2021, 1, 31)); payment.asp04__Payment_Stage__c = AsperatoServices.PAYMENT_STATE_COLLECTED; insert payment;
Can anyone help me understand why this test isn't passing?
Thanks in advance.