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
adreameradreamer 

Test method with API 24

I am seeing a strange behaviour in test methods when moving classes to version 24 of the API.

 

The calss in question is an implementation of a Batch Job.

 

The start method includes a try/catch block.

 

One of the test methods for the class tries to simulate an exception on the start method. To force the exception in the test method I am passing a query that will lead an empty result set. 

 

When the class API version is 19, this works fine in the sense that the test method forces the exeption, and this is caught in the try/catch block as expected. In the catch block I send an email to the system admin to notify the excpetion and its cause.

 

However when the class API version is 24,  I get a test failure (despite that the coverage remains the same). Looking at the debug logs of the test run, I can see that the exception is caught, and that the email is sent.

 

What is strange is that the test method now fails with version 24.

 

Any ideas ?

 

Thanks

Fernando