You need to sign in to do that
Don't have an account?
Bhagya
can someone help me with test class for below code?
public class UpdateOpportunity {
public static void descriptionUpdate() {
List<Opportunity> opp = [SELECT Id,Name,Description From Opportunity WHERE StageName='Closed Won'limit 5];
System.debug(opp);
for ( Opportunity opps :opp)
{
if(opps.Description == Null){
opps.Description = 'This Opportunity is converted into Account';
}
else if(opps.Description == ''){
opps.Description = 'This Opportunity is converted into Account';
}
}
Update opp;
}
}
public static void descriptionUpdate() {
List<Opportunity> opp = [SELECT Id,Name,Description From Opportunity WHERE StageName='Closed Won'limit 5];
System.debug(opp);
for ( Opportunity opps :opp)
{
if(opps.Description == Null){
opps.Description = 'This Opportunity is converted into Account';
}
else if(opps.Description == ''){
opps.Description = 'This Opportunity is converted into Account';
}
}
Update opp;
}
}
You can take reference from the below test class:-
However, if you make these changes it will cover 100 %.
In case you find any other issue please mention.
If you find your Solution then mark this as the best answer.