I'm using Event Monitoring & would like to use @SeAllData = true in my unit tests, so that I can leverage pre-existing logs.
However, when I enable it & query an Event Monitoring object, I end up getting a System.UnexpectedException.
Here is my unit test.
@isTest
public class Test_Logic {
@isTest (SeeAllData=true) static void TestLoginQuery(){
DateTime StartDate = DateTime.now().addhours(-10000);
DateTime EndDate = DateTime.now();
List<SObject> sobjs = new List<SObject>();
sobjs.addAll([SELECT EventIdentifier, EventDate, SourceIp, Browser, Platform, LoginUrl, HttpMethod, TlsProtocol, Status, PolicyOutcome
FROM LoginEvent
WHERE EventDate > :StartDate AND EventDate < :EndDate]);
}
}
When I run it, I get the following error:
FATAL_ERROR System.UnexpectedException: common.exception.SfdcSqlException: We encountered an unexpected error. Contact Salesforce Customer Support. Error ID: 2095101290-105728 (-999027016)