Thanks to @jaco0646:
Note that @DataJpaTest
is itself annotated with @Transactional
causing the whole test to run in a single transaction. Try using @SpringBootTest
to see if that makes a difference.
– jaco0646
Infact with @SpringBootTest it works, basically the @DataJpaTest are itself @Transactional, so it performes rollback only at the end of the test, not at the end of the method orderService.insertNewOrder.