TestSetup is a JUnit class you can use if you want to introduce
initialization in your JUnit tests that only get invoked once,
and not once before test method, which is what JUnit does
(making it difficult to make sure that an initialization method
is only invoked once during the lifetime of the class). I wrote
more about this oddity not long ago.  A recent weblog entry
about TestSetup shows how to use it, which is pretty
straightforward. I still have a big problem with this solution,
and what JUnit forces you to do to work around this “design
choice”: it forces you to introduce static methods in your code.
I don’t have anything against static methods in general, I tend
to use them as much as possible whenever they don’t need access
to any non-static fields since it decreases the coupling between
my classes. However, static methods are particularly evil when
they modify state, and by extension, force you to declare static
fields.  Which is exactly the only choice that JUnit leaves you.
The problem with non-