As a heavy TestNG user, this is not a problem, since @{Before,After}Class
methods are not static
...
But in JUnit, they are.
And this is quite a problem for what I am currently doing.
I am writing assertions for java.nio.file.Path for assertj, which uses JUnit 4.x for tests. Some assertions require that I initialize a FileSystem
(a memoryfs to be precise) to test them; such a filesystem should, ideally, be initialized at the test class level and not per test. And depending on the test class, I need to initialize the contents of that filesystem differently.
Right now however, I use @Before
/@After
since I don't know better...
Again, with TestNG, not a problem, since @{Before,After}Class
are not static. So, how do you do this with JUnit?
.