How to Override a OnApplicationEvent method from Running on StartupEvent in Tests in Micronaut Application

377 Views Asked by At

I have a OnApplicationEvent which executes some fancy scheduled code whenever the server spins up. What I want to do is disable/Override this Call for all at least some of my Unit Tests. I am working in Micronaut Application.

How can I do that?

1

There are 1 best solutions below

0
RENATO MACIEL On

The answer from pks18 on the @Requires(notEnv = Environment.TEST) helped me.