You can add the @DirtiesContext(classMode=ClassMode.AFTER_CLASS) at the class level and the context will get closed once all the tests in the methods are done. You will get the same functionality as your current code.
You can add the @DirtiesContext(classMode=ClassMode.AFTER_CLASS) at the class level and the context will get closed once all the tests in the methods are done. You will get the same functionality as your current code.