lundi 5 octobre 2015

JUnit @BeforeClass non-static work around for Spring Boot application

As you know, JUnit's @BeforeClass annotation must be declared static if you want it to run once before all the @test methods.

However, this cannot be used with dependency injection.

I want to clean up a database that I @Autowire with Spring Boot, once before I run my JUnit tests. I cannot @Autowire static fields so I need to think of a work around.

Any ideas?

Thanks

Aucun commentaire:

Enregistrer un commentaire