You need to sign in to do that
Don't have an account?
Rahul Chauhan 33
my requirement is write a test class
My class is:-
public class Contactvfpage
{
public Map <string,List<Contact>> contactMap {get;set;}
public Contactvfpage() {
contactMap = new Map < string, List < Contact >> ();
List<Contact> conlist = [Select name,Email,Account.Name from Contact Where Account.Name != null Limit 100];
list<Contact> tempConList;
for (Contact con : conlist) {
if(contactMap.containskey(con.account.Name)) {
tempConList = contactMap.get(con.account.Name);
tempConList.add(con);
} else {
tempConList = new list<contact>();
tempConList.add(con);
}
contactMap.put(con.account.Name,tempConList);
}
} }
i am trying this code to write its test class :--
@isTest
public class Contactvfpage_Test {
public static testmethod void testInsertAccount(){
List<Contact> conlist = new List<Contact>([Select name,Email,Account.Name from Contact Where Account.Name != null Limit 100]);
}
}
Please help me how to write test class
thanks in advance
public class Contactvfpage
{
public Map <string,List<Contact>> contactMap {get;set;}
public Contactvfpage() {
contactMap = new Map < string, List < Contact >> ();
List<Contact> conlist = [Select name,Email,Account.Name from Contact Where Account.Name != null Limit 100];
list<Contact> tempConList;
for (Contact con : conlist) {
if(contactMap.containskey(con.account.Name)) {
tempConList = contactMap.get(con.account.Name);
tempConList.add(con);
} else {
tempConList = new list<contact>();
tempConList.add(con);
}
contactMap.put(con.account.Name,tempConList);
}
} }
i am trying this code to write its test class :--
@isTest
public class Contactvfpage_Test {
public static testmethod void testInsertAccount(){
List<Contact> conlist = new List<Contact>([Select name,Email,Account.Name from Contact Where Account.Name != null Limit 100]);
}
}
Please help me how to write test class
thanks in advance
Best Answer chosen by Rahul Chauhan 33
Raj Vakati
Use this code ..100%