Getting error message when I'm running the test don't know what's wrong with this code
this is the error msg: System.StringException: Invalid id: recordtype.id
Stack Trace: Class.LeadEventCreation.dosave: line 13, column 1
Class.LeadEventCreation.test_BathSolution: line 50, column 1
public with sharing class LeadEventCreation
{
public PageReference dosave()
{
if(!Test.isRunningTest())
insert objlead;
objlead.recordTypeId = apexpages.currentPage().getparameters().get('id'); // Line 13,column 1
if(!Test.isRunningTest())
update objlead;
objevent.whoId = objlead.id;
if(!Test.isRunningTest())
insert objevent;
return (new pagereference('/'+objlead.id).setredirect(true));
}
public Lead objlead { get; set; }
public Event objevent { get; set; }
public LeadEventCreation ()
{
objlead = new Lead();
objevent = new Event();
}
private static testmethod void test_BathSolution()
{
test.startTest();
Lead objlead = new lead();
objlead.LastName= 'test name';
objlead.Response_Channel__c = 'Email';
objlead.Status = 'Hoax';
objlead.Products__c = 'Shower';
objlead.leadSource = 'Website';
objlead.Geo_Code__c = 'North';
objlead.Product_Type__c='Walk in';
objlead.Medium__c = 'All The Best';
objlead.DoNotCall = False;
database.insert(objlead,false);
RecordType recordtype = [select id,name,sobjecttype from RecordType where sobjecttype = 'Lead' limit 1];
objlead.RecordTypeId = recordtype.id;
database.update(objlead,false);
LeadEventCreation Bsolution= new LeadEventCreation ();
ApexPages.currentPage().getParameters().put('id','recordtype.id');// line 50, Column 1
Bsolution.doSave();
test.stoptest();
}
}