function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Irina Aristova 10Irina Aristova 10 

Advanced Apex Specialist Superbadge Step 5 Error

I am getting this error on step 5: Challenge Not yet complete... here's what's wrong:  Ensure that you create the OrderUpdate_UnitTest test method with the proper declaration and proper access modifier, to ensure best practices.
I tried make it public, private, using @isTest, test method, still having same error.

Here is the code:@isTest (seeAllData=false)
private class OrderTests {

    @testSetup
    static void SetupTestData(){
        TestDataFactory.InsertTestData(5);
    }
   
    @isTest
     public static void OrderUpdate_UnitTest(){

       SetupTestData();
        Test.startTest();
            Order order = [Select name,Status, Id from Order limit 1];
            Product2 prod = [Select Quantity_Ordered__c, Name, Id from Product2 limit 1];
        
            order.Status = Constants.ACTIVATED_ORDER_STATUS;
            update order;
        
            Product2 currentProducts = [Select Quantity_Ordered__c, Name, Id from Product2 limit 1];
        
            TestDataFactory.VerifyQuantityOrdered(prod,currentProducts,Constants.DEFAULT_ROWS);
            System.assertNotEquals(null, currentProducts);
        Test.stopTest();
    }
}
Miguel MotaMiguel Mota
I have a similar issue with a similar code, I aldo tried a lot of different modifier and nothings works
Irina Aristova 10Irina Aristova 10
I think it has nothing to do with modifies. I debugged the code and saw that when they runs verification, they run anonymous block testDataFactory.verifyQuantityOrdered( originalProduct, updatedProduct, 20 ); method. I see that it failed with the error: Assertion Failed: Expected: 20, Actual: 10. I think they have a bug there. I think they should run: testDataFactory.verifyQuantityOrdered( originalProduct, updatedProduct, 10 );
Not sure what to do with it.