'@Transactional annotation and @Sql annotation doesn't work together in spring test

I'm trying to write some tests for my default dao class and I want to execute SQL script on a test method via @sql annotation and use @Transactional annotation together, my script is executed but transaction is not rolled back:

@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = TestDaoConfig.class)
class DefaultDaoImplTest {

    @Transactional()
    @Sql("/dropAllobjects.sql")
    @Test
    void findAll_ShouldThrowDaoException_WhenTablesNotExist() {
        assertThrows(DaoException.class, () -> defaultDaoImpl.findAll());
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source