Up to now we call CleanupService before and after each test method. The CleanupService deletes all entities from the persistence.
It seems, that a simpler implementation is possible, as mentioned in https://docs.spring.io/spring/docs/current/spring-framework-reference/testing.html#testcontext-tx
By annotating a test class with @Transactional, all methods in it are executed in a transaction and automatically rolled back after method completion.
Up to now we call CleanupService before and after each test method. The
CleanupService
deletes all entities from the persistence. It seems, that a simpler implementation is possible, as mentioned in https://docs.spring.io/spring/docs/current/spring-framework-reference/testing.html#testcontext-tx By annotating a test class with@Transactional
, all methods in it are executed in a transaction and automatically rolled back after method completion.