You need to sign in to do that
Don't have an account?
Shruthi GM 4
How to write test class for the below class?
public with sharing class AccountSelectClassController{
//Our collection of the class/wrapper objects wrapAccount
public List<wrapAccount> wrapAccountList {get; set;}
public List<Account> selectedAccounts{get;set;}
public AccountSelectClassController(){
if(wrapAccountList == null) {
wrapAccountList = new List<wrapAccount>();
for(Account a: [select Id, Name from Account limit 25]) {
// As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
wrapAccountList.add(new wrapAccount(a));
}
}
}
public void processSelected() {
selectedAccounts = new List<Account>();
for(wrapAccount wrapAccountObj : wrapAccountList) {
if(wrapAccountObj.selected == true) {
selectedAccounts.add(wrapAccountObj.acc);
}
}
}
}
Please help!!!
//Our collection of the class/wrapper objects wrapAccount
public List<wrapAccount> wrapAccountList {get; set;}
public List<Account> selectedAccounts{get;set;}
public AccountSelectClassController(){
if(wrapAccountList == null) {
wrapAccountList = new List<wrapAccount>();
for(Account a: [select Id, Name from Account limit 25]) {
// As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
wrapAccountList.add(new wrapAccount(a));
}
}
}
public void processSelected() {
selectedAccounts = new List<Account>();
for(wrapAccount wrapAccountObj : wrapAccountList) {
if(wrapAccountObj.selected == true) {
selectedAccounts.add(wrapAccountObj.acc);
}
}
}
}
Please help!!!
try below code, you have 100% code coverage for both class Thanks
let me inform if it helps you and mark your qiestion as solved :)
All Answers
public Account acc {get; set;}
public Boolean selected {get; set;}
public wrapAccount(Account a) {
acc = a;
selected =selected ;
}
}
try below code, you have 100% code coverage for both class Thanks
let me inform if it helps you and mark your qiestion as solved :)
Thank you...:)