Fix some tests to be able to run it in JUnit