You need to sign in to do that
Don't have an account?
Jo Higgerson
expecting a semi-colon, found '<EOF>'
This is my first test class and I'm not at all sure what I'm doing wrong, I get the error expecting a semi-colon, found '<EOF>' when trying to run this
test class. The code is as follows:
@isTest
public class ICNFILLTest {
static testMethod void validateICN() {
BMCServiceDesk__Incident__c b = new BMCServiceDesk__Incident__c(ICN_Circuit_No__c ='a0AM0000005KitpMAC');
insert b;
b.ICN_Circuit_No__c = '';
update b;
}
}
I tried to make it as simple as possible and I still get the error. Any help would be greatly appreciated!
test class. The code is as follows:
@isTest
public class ICNFILLTest {
static testMethod void validateICN() {
BMCServiceDesk__Incident__c b = new BMCServiceDesk__Incident__c(ICN_Circuit_No__c ='a0AM0000005KitpMAC');
insert b;
b.ICN_Circuit_No__c = '';
update b;
}
}
I tried to make it as simple as possible and I still get the error. Any help would be greatly appreciated!
What is the type of ICN_Circuit_No__c field ? Make sure we are providing all mandatory fields.
Here is what I have now, simplified by just trying to insert and added the mandatory fields and it appears to work, I get the result of 1/1 Test Methods Passed. But it didn't create an incident. Is there something else I need to do? I clicked on Run Test but does that actually make it run?
@isTest(SeeAllData=true)
public class ICNFILLTest {
static testMethod void validateICN() {
BMCServiceDesk__Incident__c b = new BMCServiceDesk__Incident__c(ICN_Circuit_No__c ='a0AM0000005KitpMAC',
BMCServiceDesk__FKClient__c = '005F0000003es2rIAA',BMCSERVICEDESK__FKACCOUNT__C = '001M000000jMz5FIAS',
BMCServiceDesk__FKCategory__c = 'a17M00000036DFIIA2');
insert b;
}
}
Can you share class or trigger code which you are trying to cover from this class, so I can guide you..
Thansk
Sandeep
trigger ICNFill on BMCServiceDesk__Incident__c (before insert, before update) {
List<BMCServiceDesk__Incident__c> ICNIncident = Trigger.new;
String CircNo = ICNIncident[0].ICN_Circuit_No__c;
if(String.isNotBlank(CircNo)) {
Integer len;
len = CircNo.length();
if(len > 0) {
List<BMCServiceDesk__BMC_BaseElement__c> ICNList = [Select ICN_Channel_No__c,
ICN_Circuit_Status__c,
ICN_Circuit_Type__c,
ICN_Site_Business_Phone__c,
ICN_Cell_Phone__c,
ICN_Operation_Hours__c,
ICN_Managed_By__c,
ICN_Org_Name__c,
ICN_Rate_Limit_Amount__c,
ICN_Router_Interface__c,
ICN_Router_Name__c,
ICN_Site_Address__c,
ICN_Site_City__c,
ICN_Site_ID__c,
ICN_Site_Name__c,
ICN_Site_Phone__c,
ICN_Site_Zip_Code__c,
ICNZendRTC__c,
ICNZendMSA__C,
ICN_Parent_Circuit__c,
ICNAendRTC__c,
ICNAendMSA__c,
ICN_Comments__c,
ICN_First_Name__c,
ICN_Last_Name__c,
ICN_MLPP_MFR_VLAN_No__c
from BMCServiceDesk__BMC_BaseElement__c where ID = :CircNo];
ICNIncident[0].ICN_Channel_No__c = ICNList[0].ICN_Channel_No__c;
ICNIncident[0].ICN_Circuit_Status__c = ICNList[0].ICN_Circuit_Status__c;
ICNIncident[0].ICN_Contact_Business_Phone__c = ICNList[0].ICN_Site_Business_Phone__c;
ICNIncident[0].ICN_Contact_Cell_Phone__c = ICNList[0].ICN_Cell_Phone__c;
ICNIncident[0].ICN_Managed_By__c = ICNList[0].ICN_Managed_By__c;
ICNIncident[0].ICN_Org_Name__c = ICNList[0].ICN_Org_Name__c;
ICNIncident[0].ICN_Rate_Limit_Amount__c = ICNList[0].ICN_Rate_Limit_Amount__c;
ICNIncident[0].ICN_Router_Interface__c = ICNList[0].ICN_Router_Interface__c;
ICNIncident[0].ICN_Router_Name__c = ICNList[0].ICN_Router_Name__c;
ICNIncident[0].ICN_Site_Address1__c = ICNList[0].ICN_Site_Address__c;
ICNIncident[0].ICN_Site_City__c = ICNList[0].ICN_Site_City__c;
ICNIncident[0].ICN_Site_ID__c = ICNList[0].ICN_Site_ID__c;
ICNIncident[0].ICN_Site_Name__c = ICNList[0].ICN_Site_Name__c;
ICNIncident[0].ICN_Site_Phone__c = ICNList[0].ICN_Site_Phone__c;
ICNIncident[0].ICN_Site_Zip_Code__c = ICNList[0].ICN_Site_Zip_Code__c;
ICNIncident[0].ICNZendRTC__c = ICNList[0].ICNZendRTC__c;
ICNIncident[0].ICNZendMSA__c = ICNList[0].ICNZendMSA__c;
ICNIncident[0].ICNAendRTC__c = ICNList[0].ICNAendRTC__c;
ICNIncident[0].ICNAendMSA__c = ICNList[0].ICNAendMSA__c;
ICNIncident[0].ICN_Parent_Circuit__c = ICNList[0].ICN_Parent_Circuit__c;
ICNIncident[0].ICNSite_Contact_First_Name__c = ICNList[0].ICN_First_Name__c;
ICNIncident[0].ICNSite_Contact_Last_Name__c = ICNList[0].ICN_Last_Name__c;
ICNIncident[0].ICN_Circuit_Type__c = ICNList[0].ICN_Circuit_Type__c;
ICNIncident[0].ICNMLPP_MFR_VLAN_No__c = ICNList[0].ICN_MLPP_MFR_VLAN_No__c;
ICNIncident[0].ICN_Comments__c = ICNList[0].ICN_Comments__c;
}
}
}
Thanks so much for your help!!
Inside a running tests, you could call a create data function, perform a test/assertion, and that would work...
Also, you're using the ID's from what seems to be real data. You might consider rewriting the test to work in any environment by creating the data you need as you go...
For example, I have a an object, Interview, that depends on an Application object, which in turn is dependent on a Requisition. I create dummy/placeholders just so that I can create the Interview and run my test.