function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jo HiggersonJo 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:
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!
sandeep sankhlasandeep sankhla

What is the type of ICN_Circuit_No__c  field ? Make sure we are providing all mandatory fields.
Jo HiggersonJo Higgerson
Thanks for your help!!!
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?


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; 

sandeep sankhlasandeep sankhla

Can you share class or trigger code which you are trying to cover from this class, so I can guide you..

Jo HiggersonJo Higgerson
Here is the trigger that I am trying to test:

trigger ICNFill on BMCServiceDesk__Incident__c (before insert, before update) {
 List<BMCServiceDesk__Incident__c> ICNIncident =;
    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,
                                     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!!
Leslie  KismartoniLeslie Kismartoni
Jo, running the test, even with See All Data set won't create an incident that you'd be able to see outside the test run...

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.
public with sharing class tst_interview {
	public static testmethod void testController(){      
        Requisition__c newReq = new Requisition__c(Name = 'Test');
        insert newReq;
		Application__c newApp = new Application__c(Requisition__c = newReq.Id);
		newApp.Email__c = 'newApp@newApp.newApp';
		insert newApp;
		Interview__c newInterview = new Interview__c(Application__c = newApp.Id);
		insert newInterview;		
        ApexPages.currentPage().getParameters().put('id', newInterview.Id);
        ctr_interview interviewCont = new ctr_interview(new ApexPages.StandardController(newInterview));
        String jsonString = interviewCont.jsonString;
        Map<String, Object> jsonMap = utilities.convertJSONToMap(jsonString);                
		System.assertNotEquals(jsonMap, null);        


Jo HiggersonJo Higgerson
I got it to work, thanks for all your help!!  I only got the expecting a semi-colon, found '<EOF>' in the developer console so if someone else is having the same issue, try testing in setup-develop-Apex Classes etc.  and then I have to add the required fields as sandeep suggested.  Then to get it to work in production, I had to change the field references I was setting because the ID numbers are different in production.