Here this is the class:
public class relatedList
{
public account acc{set;get;}
public contact con{set;get;}
public string accname{set;get;}
public void getdata() {
acc=[select name,id from account where name=:accname];
con=[select id,name,title,email,phone from contact where account.id=:acc.id limit 1];
}
}
Here is Test Class which covers only 83% why not 100%? Showing error like list has no rows. Help me to resolve this.
@isTest
public class relatedList_TC
{
static testMethod void testMthd()
{
relatedList rl=new relatedList();
account a=new account(name='xxx');
contact c=new contact(lastname='yyy',accountid=a.id);
rl.getData();
}
}