In a JUnit test that persists entities, how can I disable or mock a registered EntityListener?
@Entity
@EntityListeners(Listener.class)
public class Entity {}
public class Listener {
@PostPersist
public void postPersist(Entity entity) {...}
}
@RunWith(SpringRunner.class)
@SpringBootTest
public class Tests {
//how to disable or mock Listener here?
@Test
public void test() {
...
entityRepository.save(entity);
}
}