Как можно отключить или имитировать зарегистрированный EntityListener в тесте JUnit, сохраняющем объекты?
@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);
}
}
Подробнее здесь: https://stackoverflow.com/questions/572 ... junit-test