You need to sign in to do that
Don't have an account?
Constructor not defined error in test class
I have a an extension controller and a test class
When i run the test class everything is fine and when i try to deploy the test class it tells me my constructor is not defined. Can someone help me please????
Thanks in advance.
Here is my class
public class newWorkOrderWizardController {
private final Work_Order__c workObj;
public newWorkOrderWizardController(ApexPages.StandardController stdController) {
this.workObj = (Work_Order__c)stdController.getRecord();
}
Work_Order__c workorder {get{if(workorder == null) workorder = new Work_Order__c();
return workorder;}set;}
Work_on_Circuit__c woc {get{if(woc == null) woc = new Work_on_Circuit__c();
return woc;}set;}
public List<circuitWrapper> circuitList { get; set; }
public PageReference step2(){
return Page.displaycircuits;
}
public PageReference stepBack(){
return Page.createWorkOrder;
}
public PageReference cancel(){
PageReference woPage = new PageReference('/a05/o');
woPage.setRedirect(true);
return woPage;
}
public List<circuitWrapper> getCircuits() {
if(circuitList == null) {circuitList = new List<circuitWrapper>();
for(Circuits__c ckt : [select Id,Name, Circuit_ID__c,Service_Level__c, Circuit_Status__c,
Circuits__c.RecordType.Name from Circuits__c where
(Circuits__c.A_CPE_Location_LU__c =: workorder.CPE_Location__c and
Circuits__c.Circuit_Status__c IN ('Active') and
Circuits__c.RecordType.Name IN ('Customer Circuit')) or
(Circuits__c.Z_Location_LU__c =: workorder.Location__c and
Circuits__c.RecordType.Name IN ('Off-Net Circuit') and
Circuits__c.Circuit_Status__c IN ('Active'))Order By Circuits__C.RecordType.Name ]){
circuitList.add(new circuitWrapper(ckt));
}
}return circuitList;
}
public PageReference save(){
insert workorder;
List<Circuits__c> selectedCircuits = new List<Circuits__c>();
for(circuitWrapper cCkt : getCircuits()) {
if(cCkt.selected == true){
selectedCircuits.add(cCkt.skt);
}
}
List<Work_on_Circuit__c> newWorkOnCircuits = new List<Work_on_Circuit__c>();
for(Circuits__c ckt:selectedCircuits){
newWorkOnCircuits.add(new Work_on_Circuit__c(Circuit__c = ckt.id, Work_Order__c = workorder.id));
}
insert newWorkOnCircuits;
PageReference woPage = new ApexPages.StandardController(workorder).view();
woPage.setRedirect(true);
return woPage;
}
public class circuitWrapper{
public Circuits__c skt {get;set;}
public Boolean selected {get;set;}
public circuitWrapper(Circuits__c ckt){
skt = ckt;
selected = false;
}
}
}
Here is the test class
@isTest
private class WorkOrderTest {
static testmethod void WorkOrdertest(){
Location__c newloc = new Location__c(Name='Test Location', Svc_State__c = 'GA');
insert newloc;
Location__c newloc2 = new Location__c(Name='Test Location2', Svc_State__c = 'GA');
insert newloc2;
Location__c newloc3 = new Location__c(Name='Test Location3', Svc_State__c = 'GA');
insert newloc3;
Location__c newloc4 = new Location__c(Name='Test Location4', Svc_State__c = 'GA');
insert newloc4;
CPE_Location__c cpe1 = new CPE_Location__c(Name='cpeloc1', Location_Name__c = newloc.id);
insert cpe1;
CPE_Location__c cpe2 = new CPE_Location__c(Name='cpeloc2', Location_Name__c = newloc2.id);
insert cpe2;
CPE_Location__c cpe3 = new CPE_Location__c(Name='cpeloc3', Location_Name__c = newloc3.id);
insert cpe3;
CPE_Location__c cpe4 = new CPE_Location__c(Name='cpeloc4', Location_Name__c = newloc4.id);
insert cpe4;
Order__c order1 = new Order__c(A_Location__c=newloc.id, A_CPE_Location__c=cpe1.id,Z_Location__c=newloc2.id,
Z_CPE_Location__c=cpe2.id );
insert order1;
order__c order2 = new Order__c(A_Location__c=newloc3.id, A_CPE_Location__c=cpe3.id,Z_Location__c=newloc4.id,
Z_CPE_Location__c=cpe4.id );
insert order2;
Circuits__c ckt1 = new Circuits__c(Order__c=order1.id,
A_Location_LU__c=newloc.id,Z_Location_LU__c=newloc2.id,A_CPE_Location_LU__c=cpe1.id,Z_CPE_Location_LU__c=cpe2.id);
insert ckt1;
Circuits__c ckt2 = new Circuits__c(Order__c=order2.id,
A_Location_LU__c=newloc3.id,Z_Location_LU__c=newloc4.id,A_CPE_Location_LU__c=cpe3.id,Z_CPE_Location_LU__c=cpe4.id);
insert ckt2;
Circuits__c ckt3 = new Circuits__c(Order__c=order1.id,
A_Location_LU__c=newloc.id,Z_Location_LU__c=newloc2.id,A_CPE_Location_LU__c=cpe1.id,Z_CPE_Location_LU__c=cpe2.id);
insert ckt3;
Circuits__c offckt1 = new Circuits__c(Order__c=order1.id,
A_Location_LU__c=newloc.id,Z_Location_LU__c=newloc2.id,A_CPE_Location_LU__c=cpe1.id,Z_CPE_Location_LU__c=cpe2.id,Sup
ports_Customer_Circuit__c=ckt1.id);
insert offckt1;
Circuits__c offckt2 = new Circuits__c(Order__c=order1.id,
A_Location_LU__c=newloc3.id,Z_Location_LU__c=newloc4.id,A_CPE_Location_LU__c=cpe3.id,Z_CPE_Location_LU__c=cpe4.id,Su
pports_Customer_Circuit__c=ckt2.id);
insert offckt2;
//PageReference pageRef = Page.success;
//Test.setCurrentPage(pageRef);
Work_Order__c wrkorder = new Work_Order__c();
ApexPages.StandardController sc = new ApexPages.StandardController(wrkorder);
newWorkOrderWizardController controller = new newWorkOrderWizardController(sc);
wrkorder.Work_Order_Type__c ='Copper to Off-Net Wavelength';
wrkorder.Work_Order_Type__c = 'Roll';
wrkorder.CPE_Location__c = cpe1.id;
wrkorder.Location__c = newloc3.id;
controller.cancel();
controller.stepBack();
controller.step2();
controller.save();
}
}
Which line causes the error?