+ Start a Discussion
Vipin K 23Vipin K 23 

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.

User-added image

Code base:
@isTest(seeAllData =False)
public class OrderTests {
    public static void SetupTestData(){

    Static testmethod void OrderUpdate_UnitTest(){
        Product2 originalproduct = [SELECT Id, Family, Name, Quantity_Ordered__c, Quantity_Remaining__c FROM Product2 LIMIT 1];
        Order od = [SELECT id, Status FROM Order LIMIT 1];
        od.status = constants.ACTIVATED_ORDER_STATUS;
        Update od;
        Product2 updatedProduct = [SELECT Family,Id,Name,Quantity_Ordered__c ,Quantity_Remaining__c FROM Product2 WHERE id=:originalproduct.Id LIMIT 1];
Thanks in advance.
Irina Aristova 10Irina Aristova 10
Having same problem, tried different declaration and modifies, nothing worked.
Vasilina Veretennikova 8Vasilina Veretennikova 8
The same issue. Please find similar topics:


Vipin K 23Vipin K 23
Finally got the solution, created a case with salesforce trailahead support and helped me figured out what I was missing.
Use the below code it worked for me 
@isTest (seeAllData=false)
private class OrderTests {
    static void SetupTestData() {
   @isTest private static void orderUpdate_UnitTest() {
        Order selectedOrder = [Select name,Status, Id from Order limit 1];
        Product2 oldProd = [Select Quantity_Ordered__c, Name, Id from Product2 limit 1];
        selectedOrder.Status = Constants.ACTIVATED_ORDER_STATUS;
        update selectedOrder;
        Product2 updatedProd = [Select Quantity_Ordered__c, Name, Id from Product2 limit 1];
// This was missing for my code 
 @isTest private static void orderExtension_UnitTest() {}