You need to sign in to do that
Don't have an account?
lalitarora
Test class for logout event stream?
trigger LogoutEventTrigger on LogoutEventStream (after insert) {
LogoutEventStream event = Trigger.new[0];
String EventjsonString = json.serialize(Trigger.new[0]);
LogoutEventtriggerHandler.CreateLog(EventjsonString);
}
LogoutEventStream event = Trigger.new[0];
String EventjsonString = json.serialize(Trigger.new[0]);
LogoutEventtriggerHandler.CreateLog(EventjsonString);
}
If it helps please like and mark as correct, it may help others.
Hi Agustin,
When I wrote a test class about LogoutEventStream, I got an error below.
System.TypeException: DML operation INSERT not allowed on LogoutEventStream
I definitely use the code 'EventBus.publish(new LogoutEventStream());'
What's the problem?
static void testLogoutEventStream() {
User automatedProcessUser = [SELECT Id FROM User WHERE Name = 'Automated Process' LIMIT 1][0];
User testUser = new User(...);
System.runAs(automatedProcessUser) {
Test.startTest();
EventBus.publish(new LogoutEventStream(UserId = testUser.Id));
Test.stopTest();
}
}