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
chandu kumarchandu kumar 

unit test class for this pagereference method?

public PageReference Add (){
        boolean duplicate = false;
        if(UserSelectVAlue != null){
            Product2 addedprd = [select id,name, Description, ProductCode, Family from Product2 where name=: UserSelectVAlue];
            addedprd.Description = addedprd.name;
            for (Product2 prd: newprd){
                if(prd.id == addedprd.Id){
                    duplicate = true;
                    break;
                }