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
BBeairdBBeaird 

Internal Salesforce Error in test method (currency related?)

When executing a test method (using API version 24.0), I am getting this error:

Internal Salesforce Error: 883366085-8175 (-1490970800) (-1490970800).

 

I have isolated the problem to this section of code that attempts to multiply a currency value (stored in a custom setting):

double chinaRate = [SELECT conversionrate FROM currencytype WHERE isocode = 'CNY'].conversionRate;
VL_CountrySettings__c countrySetting = new VL_CountrySettings__c();
countrySetting.Name = 'us';
countrySetting.Allowance__c = 40.00; //This is a currency field
insert countrySetting;

VL_CountrySettings__c usSettings = VL_CountrySettings__c.getInstance('us');
decimal allowance_value = chinaRate * usSettings.Allowance__c; //This line causes the error

 

If I run that exact same code anonymously (without the insert because the record is accessible when not testing), it runs fine without error.

 

Any ideas why I'm getting this strange error and only in a test method? I also opened a case and am waiting on a response.

yvk431yvk431

guess its the issue with the new release update, salesforce will fix it soon. For now try changing your test controller api version to  22 or 21 and check.

 

 

--yvk

BBeairdBBeaird

I just confirmed that switching the test class to 23.0 works, although since that suddenly grants the tests access to data, I'll have to temporarily change a few things about how it works. Hope they get this fixed shortly.