You need to sign in to do that
Don't have an account?
uHaveOptions
Help on TestClass
I have this APEX Class but it's not passing. Can you tell me why?
public class PQ_Update { public static void PQ_Update(List<ProdQueue__c> pq){ List<Listing__c> ls= new list<Listing__c>(); for(ProdQueue__c i : pq){ ls.add(i.Listing__r); for (Listing__c l : ls){ l.Production_Status__c=i.Status__c; l.OM_Approve__c=i.OM_Approve__c; l.Producer__c=i.Producer__c; update l; } } } }
APEX @test
@isTest public class PQ_UpdateTEST { public static testMethod void PQ_Update(){ Listing__c l=new Listing__c(); insert l; ProdQueue__c pq=new ProdQueue__c(Listing__c=l.id,Status__c='On-Market',OM_Approve__c='Yes',Producer__c='Brian'); insert pq; } }
List<ProdQueue__c> newlist = new List<ProdQueue__c>();
newlist.add(pq);
PQ_Update.PQ_Update(newlist);
Please find the code below:
Class:
// Here I changed the method name just to make sure that its name is diff from Class Name.
Test Class:
Please do let me know if it helps you.
Regards,
Mahesh
PQ_Update.PQ_UpdateOne(pqList); <- this is giving an error
Method does not exist or incorrect signature: PQ_Update.PQ_UpdateOne(List<ProdQueue__c>)
Still no code coverage
Please take my class and replace it with your class as I changed the method name.
Regards,
Mahesh
code coverage 6/9 66%
error is in here.
PQ_Update.PQ_UpdateOne(pqList); <- this is giving an error
Method does not exist or incorrect signature: PQ_Update.PQ_UpdateOne(List<ProdQueue__c>)
Please paste your class and test class here.
What I am saying is I changed the method name, please copy my class and my test class.
I changed both Apex Class and Test Class.
Regards,
Mahesh
I copied what you gave me.
Method does not exist or incorrect signature: PQ_Update.PQ_UpdateOne(List<ProdQueue__c>)
Please take the above code and test it again.
--> Save the clas.
--> Save the Test Class
--> Run the Test Class
Let me know if you get any error in any step.
Regards,
Mahesh
Error: Compile Error: Method does not exist or incorrect signature: PQ_Update.PQ_Update(List<ProdQueue__c>) at line 16 column 9
Error: Compile Error: Method does not exist or incorrect signature: PQ_Update.PQ_Update(List<ProdQueue__c>) at line 16 column 9
before saving test class.
I simulated the whole process in my DE environment and everything is working fine properly.
Are you going to Setup --> Apex Class --> New and then copying the class?
If not, can you do this way.
Don't use the Developer Console for now.
Regards,
Mahesh