vendredi 25 novembre 2016

With TestNG+Spring, how to make @Bean configuration local to just one test?

I have added a @Configuration annotation and @Bean definition to one of my TestNG tests in order to override a deep @Autowired object with a mock.

Problem is, this has messed up all my other integration tests. How can I make the @Bean configuration local to just the one test?

I already tried the @DirtiesContext(classMode=ClassMode.AFTER_CLASS) annotation but that didn't work this time (although I've used it successfully in other cases).

Aucun commentaire:

Enregistrer un commentaire