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
MarniMarni 

Expression cannot be assigned at line -1 column -1

I am writing an Apex Test Class and am receiving the error: Compile Error: Expression cannot be assigned at line -1 column -1.  Can anyone help me with this??  The class below.  Any help is greatly appreciated!  Thanks!!

 

  Error: Compile Error: Expression cannot be assigned at line -1 column -1

 

@isTest
private class TestBankTransactionRollUpTrigger {

    static testMethod void testRollUpToBankTransaction() {
        Test.startTest();
        //get the Client account record type
        RecordType clientRt = [SELECT Id, DeveloperName FROM RecordType WHERE DeveloperName = 'Client'];
      
        //Client Owner of Bank Account
        Account pAccount = new Account();
        pAccount.Name = 'Client Account';
        account.RecordTypeId = clientRt.id;
        insert pAccount;
        
        //Bank Account
        Client_Fiduciary_Bank_Account__c pBankAccount = new Client_Fiduciary_Bank_Account__c();
        pBankAccount.Name = 'Bank Account';
        pBankAccount.Client_Owner_of_Account__c = pAccount.id;
        pBankAccount.Account_Number__c = '12345';
        pBankAccount.Bank_Number__c = '12345';
        pBankAccount.Last_Statement_Date__c = '5/31/2013';
        insert pBankAccount;
        
        //Bank Transaction
        Bank_Transaction__c pBankTransaction = new Bank_Transaction__c();
        pBankTransaction.Bank_Account__c = pBankAccount.id;
        pBankTransaction.Transaction_Type__c = 'Incoming Wire';
        pBankTransaction.Transaction_Date__c = '1/1/2013';
        pBankTransaction.Transaction_Amount__c = '1000000.00';
        insert pBankTransaction;
        
        //Claim
        User user = TestCreateMockData.buildTestUser(41, 'Standard User');
        insert user;
        Contact underwriter = TestCreateMockData.buildTestUnderwriter(42, 'The Underwriter');
        insert underwriter;
        Account iVosProgram = TestCreateMockData.buildTestProgramAck(43, 'iVos Program', user);
        insert iVosProgram;
        Account insured = TestCreateMockData.buildTestInsuredNoAck(44, 'Insured iVos', user);
        insert insured;
        Policy__c policy = TestCreateMockData.buildTestPolicy(45, 'The Policy', underwriter, insured);
        insert policy;
        Claim__c iVosClaim = TestCreateMockData.buildTestiVOSClaim(46, 'iVos Claim1 TBD', iVosProgram, insured, policy);
        insert iVosClaim;
        
        //create cash calls and add it to bank account
        List<Cash_Call_Request__c> cashCalls = new List<Cash_Call_Request__c>();
        
        Cash_Call_Request__c cashCall1 = new  Cash_Call_Request__c();     
        cashCall1.Claim__c = iVosClaim.id;
        cashCall1.Bank_Account__c = pBankAccount.id;
        cashCall1.Amount_Requested__c = '125000.00';
        cashCall1.Comments__c = 'legal';
        cashCall1.Submitted_for_Approval__c = true;
        cashCall1.Approved_for_Cash_Call__c = true;
        cashCall1.Submitted_for_Cash_Call__c = true;
                
        Cash_Call_Request__c cashCall2 = new  Cash_Call_Request__c();         
        cashCall2.Claim__c = iVosClaim.id;
        cashCall2.Bank_Account__c = pBankAccount.id;
        cashCall2.Amount_Requested__c = '150000.00';
        cashCall2.Comments__c = 'legal';
        cashCall2.Submitted_for_Approval__c = true;
        cashCall2.Approved_for_Cash_Call__c = true;
        cashCall2.Submitted_for_Cash_Call__c = true;
          
        cashCalls.add(cashCall1);
        cashCalls.add(cashCall2);
        insert cashCalls;
        
        //update cash call to funded and paid
        cashCall1.Cash_Call_Funded__c = true;
        cashCall1.Check_Number__c = '1234';
        cashCall1.Paid__c = true;
        cashCall1.Date_Check_Printed__c = '5/31/2013';
        cashCall1.Amount_Paid__c = '100000.00';
        cashCall1.Funding_Wire_Transfer__c = pBankTransaction.id;
        update cashCall1;
        
        //check that the total cash call requested has increased to $125000.00
        pBankTransaction = [SELECT id, name, Total_Cash_Call_Requested__c FROM Bank_Transaction__c WHERE ID = :pBankTransaction.id];
        System.assertEquals(125000, pBankTransaction.Total_Cash_Call_Requested__c);
        
        cashCall2.Cash_Call_Funded__c = true;
        cashCall2.Check_Number__c = '5678';
        cashCall2.Paid__c = true;
        cashCall2.Date_Check_Printed__c = '6/1/2013';
        cashCall2.Amount_Paid__c = '90000.00';
        cashCall2.Funding_Wire_Transfer__c = pBankTransaction.id;
        update cashCall2;
        
       //check that the total cash call requested has increased to $275000
        pBankTransaction = [SELECT id, name, Total_Cash_Call_Requested__c FROM Bank_Transaction__c WHERE ID = :pBankTransaction.id];
        System.assertEquals(275000, pBankTransaction.Total_Cash_Call_Requested__c);
        
        delete cashCall1;
        Test.stopTest();
    }
}

 

 

   

Best Answer chosen by Admin (Salesforce Developers) 
Marko LamotMarko Lamot

what is the data type of the following fields (and others)?

 

        pBankAccount.Account_Number__c = '12345';
        pBankAccount.Bank_Number__c = '12345';
        pBankAccount.Last_Statement_Date__c = '5/31/2013';

....

 

from the name of the fields It seems that they are numbers and dates. If that is the case, you have a problem here, because you are assigning text to the number/date fields and not numbers/dates. 

 

Date myDate = date.newinstance(1960, 2, 17);

 

        pBankAccount.Account_Number__c = 12345;
        pBankAccount.Bank_Number__c = 12345;

        pBankAccount.Last_Statement_Date__c = mydate;
....

 

 

All Answers

Marko LamotMarko Lamot

what is the data type of the following fields (and others)?

 

        pBankAccount.Account_Number__c = '12345';
        pBankAccount.Bank_Number__c = '12345';
        pBankAccount.Last_Statement_Date__c = '5/31/2013';

....

 

from the name of the fields It seems that they are numbers and dates. If that is the case, you have a problem here, because you are assigning text to the number/date fields and not numbers/dates. 

 

Date myDate = date.newinstance(1960, 2, 17);

 

        pBankAccount.Account_Number__c = 12345;
        pBankAccount.Bank_Number__c = 12345;

        pBankAccount.Last_Statement_Date__c = mydate;
....

 

 

This was selected as the best answer
MarniMarni

Thanks for the response!  So there are some date fields so I have updated them to match how it was done in another test class that worked.  I also found that the currency fields in the working test class were shown as 1000.00 rather than '1000.00' so I updated that as well.I checked and Account Number, Bank Number, and Check Number are all text fields.

I made updates but still getting the same error.  Below is the updated Apex Class.  Any ideas??

 

 

@isTest
private class TestBankTransactionRollUpTrigger {

    static testMethod void testRollUpToBankTransaction() {
        Test.startTest();
        //get the Client account record type and assign a date
        RecordType clientRt = [SELECT Id, DeveloperName FROM RecordType WHERE DeveloperName = 'Client'];
      
        //Client Owner of Bank Account
        Account pAccount = new Account();
        pAccount.Name = 'Client Account';
        account.RecordTypeId = clientRt.id;
        insert pAccount;
        
        //Bank Account
        Client_Fiduciary_Bank_Account__c pBankAccount = new Client_Fiduciary_Bank_Account__c();
        pBankAccount.Name = 'Bank Account';
        pBankAccount.Client_Owner_of_Account__c = pAccount.id;
        pBankAccount.Account_Number__c = '12345';
        pBankAccount.Bank_Number__c = '12345';
        pBankAccount.Last_Statement_Date__c = date.today();
        insert pBankAccount;
        
        //Bank Transaction
        Bank_Transaction__c pBankTransaction = new Bank_Transaction__c();
        pBankTransaction.Bank_Account__c = pBankAccount.id;
        pBankTransaction.Transaction_Type__c = 'Incoming Wire';
        pBankTransaction.Transaction_Date__c = date.today();
        pBankTransaction.Transaction_Amount__c = 1000000.00;
        insert pBankTransaction;
        
        //Claim
        User user = TestCreateMockData.buildTestUser(41, 'Standard User');
        insert user;
        Contact underwriter = TestCreateMockData.buildTestUnderwriter(42, 'The Underwriter');
        insert underwriter;
        Account iVosProgram = TestCreateMockData.buildTestProgramAck(43, 'iVos Program', user);
        insert iVosProgram;
        Account insured = TestCreateMockData.buildTestInsuredNoAck(44, 'Insured iVos', user);
        insert insured;
        Policy__c policy = TestCreateMockData.buildTestPolicy(45, 'The Policy', underwriter, insured);
        insert policy;
        Claim__c iVosClaim = TestCreateMockData.buildTestiVOSClaim(46, 'iVos Claim1 TBD', iVosProgram, insured, policy);
        insert iVosClaim;
        
        //create cash calls and add it to bank account
        List<Cash_Call_Request__c> cashCalls = new List<Cash_Call_Request__c>();
        
        Cash_Call_Request__c cashCall1 = new  Cash_Call_Request__c();     
        cashCall1.Claim__c = iVosClaim.id;
        cashCall1.Bank_Account__c = pBankAccount.id;
        cashCall1.Amount_Requested__c = 125000.00;
        cashCall1.Comments__c = 'legal';
        cashCall1.Submitted_for_Approval__c = true;
        cashCall1.Approved_for_Cash_Call__c = true;
        cashCall1.Submitted_for_Cash_Call__c = true;
                
        Cash_Call_Request__c cashCall2 = new  Cash_Call_Request__c();         
        cashCall2.Claim__c = iVosClaim.id;
        cashCall2.Bank_Account__c = pBankAccount.id;
        cashCall2.Amount_Requested__c = 150000.00;
        cashCall2.Comments__c = 'legal';
        cashCall2.Submitted_for_Approval__c = true;
        cashCall2.Approved_for_Cash_Call__c = true;
        cashCall2.Submitted_for_Cash_Call__c = true;
          
        cashCalls.add(cashCall1);
        cashCalls.add(cashCall2);
        insert cashCalls;
        
        //update cash call to funded and paid
        cashCall1.Cash_Call_Funded__c = true;
        cashCall1.Check_Number__c = '1234';
        cashCall1.Paid__c = true;
        cashCall1.Date_Check_Printed__c = date.today();
        cashCall1.Amount_Paid__c = 100000.00;
        cashCall1.Funding_Wire_Transfer__c = pBankTransaction.id;
        update cashCall1;
        
        //check that the total cash call requested has increased to $125000.00
        pBankTransaction = [SELECT id, name, Total_Cash_Call_Requested__c FROM Bank_Transaction__c WHERE ID = :pBankTransaction.id];
        System.assertEquals(125000, pBankTransaction.Total_Cash_Call_Requested__c);
        
        cashCall2.Cash_Call_Funded__c = true;
        cashCall2.Check_Number__c = '5678';
        cashCall2.Paid__c = true;
        cashCall2.Date_Check_Printed__c = date.today();
        cashCall2.Amount_Paid__c = 90000.00;
        cashCall2.Funding_Wire_Transfer__c = pBankTransaction.id;
        update cashCall2;
        
       //check that the total cash call requested has increased to $275000
        pBankTransaction = [SELECT id, name, Total_Cash_Call_Requested__c FROM Bank_Transaction__c WHERE ID = :pBankTransaction.id];
        System.assertEquals(275000, pBankTransaction.Total_Cash_Call_Requested__c);
        
        delete cashCall1;
        Test.stopTest();
    }
}

MarniMarni
I found the last error - it was a typo on my part -

Had:
Account pAccount = new Account();
pAccount.Name = 'Client Account';
account.RecordTypeId = clientRt.id;
insert pAccount;
But needed:
Account pAccount = new Account();
pAccount.Name = 'Client Account';
paccount.RecordTypeId = clientRt.id;
insert pAccount;

Thanks for all your help!!