This is related to Lightning Specialist Superbadge step 6 - Automate fulfillment cancellation actions.
The task is when fulfillment is Cancelled, the related OpportunityLineItem unitprice (i.e., salesprice) should be same as the Fulfillment's Deposit. Simple. I manually checked this (after setting up process builder) and is working fine, but when the trailhead app checks, it fails with the error : System.AssertException: Assertion Failed: Same value.
ISSUE: Now, if I see the debug logs (captured when Salesforce trailhead checks this). In below snippet (from debug logs) see the last 2 lines.
There is assertEquals which checks deposit and unitprice - Match.
But assertNotEqual is also checking deposit and unitPrice. It fails here. Both the values will be same, the assertNotEqual is failing because both the values are same!
Execute Anonymous: OpportunityLineItem oli1 = new OpportunityLineItem(OpportunityId=opp.Id, UnitPrice=2, quantity=1,pricebookentryid=pbe.Id, servicedate = date.newInstance(2050, 1, 1), explorer__c = sam.id); Execute Anonymous: OpportunityLineItem oli2 = new OpportunityLineItem(OpportunityId=opp.Id, UnitPrice=2, quantity=1,pricebookentryid=pbe.Id, servicedate = date.newInstance(2010, 1, 1), explorer__c = sam.id); Execute Anonymous: // make sure the deposit matches the unit price Execute Anonymous: System.assertEquals(f1.deposit__c, oli1.unitprice); // one way in the future Execute Anonymous: System.assertNotEquals(f2.deposit__c, oli2.unitprice); // one way in the past
How to fix this? Is this a bug?