• cmd loader
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies

Hi my test coverage class covers only 71%. Please help me out for 75%.

 

My code is

public with sharing class sendquote1 {


public ID quoteId {get;set;}
public String email {get;set;}
public boolean showpop{set;get;}
public sendquote1 ()
{
quoteId =apexpages.currentpage().getparameters().get('id');
system.debug('acid'+quoteId );
}
Blob body;

list<quotedocument> qdlist=new list<quotedocument>();
pagereference p1;
Blob pdfBlob;
public pagereference save()
{

for(quote q:[select id,name from quote where id=:quoteId ])
{
quotedocument qd=new quotedocument();
PageReference pdfPage = Page.quotePDF;
pdfPage.getParameters().put('id',quoteid);
pdfBlob = pdfPage.getContent();
//Attachment a = new Attachment(parentId = q.id, name=q.name + '.pdf', body = pdfBlob);
qd.quoteid=q.id;
qd.document=pdfBlob ;

qdlist.add(qd);
p1=new pagereference('/'+quoteid);
}
insert qdlist;
return p1;
}
private static testMethod void savetest()
{

Account a=new Account(Name='abc');
insert a;
Pricebook2 pb=new Pricebook2(name='sample',isactive=true);
insert pb;
Product2 p = new Product2();
p.Name = 'TEST';
insert p;
OpportunityStage stage=[select Masterlabel from OpportunityStage limit 1];
Opportunity o = new Opportunity();
o.Name='TestOpp';
o.AccountID=a.id;
o.CloseDate=date.today();
o.StageName=stage.masterlabel;
o.Pricebook2Id=pb.id;
insert o;
Quote q = new Quote();
q.opportunityId=o.id;
q.Pricebook2Id=pb.id;
q.name='TestQuote';
insert q;
Quote q1 = new Quote();
q1.opportunityId=o.id;
q1.Pricebook2Id=pb.id;
q1.name='TestQuote';
insert q1;
Blob b = Blob.valueOf('Test Data');
PageReference pref = Page.quotepdf;
pref.getParameters().put('id',q.id);

Test.setCurrentPage(pref);


quotedocument qd1=new quotedocument();
qd1.quoteid=q.id;
qd1.document=b;
insert qd1;
//ApexPages.currentPage().getParameters().put('id', q.id);

sendquote1 s=new sendquote1();

s.save();
}
}

The bold statements are not covered.

 

Thanks

 

Hi,

 

I am creating a unmanaged package. while i am adding profiles to package, system administrator is not visible. Is there any possibility to add system administrator. Please help me.

 

Thanks,

Lakshmi

HI All,

  I am trying to divide an output panel into 2 equal halfs while dynamic page refresh on clicking button.But the second half is taking more width than first half.Does anyone faced this problem of fixing the width into equal size.

Can anyone suggest an idea?

  • April 18, 2012
  • Like
  • 0

Hi my test coverage class covers only 71%. Please help me out for 75%.

 

My code is

public with sharing class sendquote1 {


public ID quoteId {get;set;}
public String email {get;set;}
public boolean showpop{set;get;}
public sendquote1 ()
{
quoteId =apexpages.currentpage().getparameters().get('id');
system.debug('acid'+quoteId );
}
Blob body;

list<quotedocument> qdlist=new list<quotedocument>();
pagereference p1;
Blob pdfBlob;
public pagereference save()
{

for(quote q:[select id,name from quote where id=:quoteId ])
{
quotedocument qd=new quotedocument();
PageReference pdfPage = Page.quotePDF;
pdfPage.getParameters().put('id',quoteid);
pdfBlob = pdfPage.getContent();
//Attachment a = new Attachment(parentId = q.id, name=q.name + '.pdf', body = pdfBlob);
qd.quoteid=q.id;
qd.document=pdfBlob ;

qdlist.add(qd);
p1=new pagereference('/'+quoteid);
}
insert qdlist;
return p1;
}
private static testMethod void savetest()
{

Account a=new Account(Name='abc');
insert a;
Pricebook2 pb=new Pricebook2(name='sample',isactive=true);
insert pb;
Product2 p = new Product2();
p.Name = 'TEST';
insert p;
OpportunityStage stage=[select Masterlabel from OpportunityStage limit 1];
Opportunity o = new Opportunity();
o.Name='TestOpp';
o.AccountID=a.id;
o.CloseDate=date.today();
o.StageName=stage.masterlabel;
o.Pricebook2Id=pb.id;
insert o;
Quote q = new Quote();
q.opportunityId=o.id;
q.Pricebook2Id=pb.id;
q.name='TestQuote';
insert q;
Quote q1 = new Quote();
q1.opportunityId=o.id;
q1.Pricebook2Id=pb.id;
q1.name='TestQuote';
insert q1;
Blob b = Blob.valueOf('Test Data');
PageReference pref = Page.quotepdf;
pref.getParameters().put('id',q.id);

Test.setCurrentPage(pref);


quotedocument qd1=new quotedocument();
qd1.quoteid=q.id;
qd1.document=b;
insert qd1;
//ApexPages.currentPage().getParameters().put('id', q.id);

sendquote1 s=new sendquote1();

s.save();
}
}

The bold statements are not covered.

 

Thanks

 

Hi All,

I'm trying to disable apex class in my sandbox, i didn't find the way to deactivate this.

Appereciate your help.

Regards,

Karthik

Hi,

 

As you all know Salesforce is phasing out s-control next year, so I am given the task to convert one functionality written in S-control to VF page.

 

My object is select more then 10000 records from the object (lets say my object 30000 records). Even consider by applying all filter criteria SOQL still need to fetch more than 10000 rows.

 

But when I try to select more then 10000 records using SOQL, apex throw a limit exception to me.

So any idea how we can select more then 10000 records in VF/Apex solution.

 

Any suggestion is appreciable.

 

Thanks

Rajan

Hello Friends,

 

I know that there is a limit of 10000 rows for SOQL query.

But I have more than 10000 rows to process, how can I do that in pure VF/Apex approach.

 

Thanks,

Sunil