[#1670] Fix some tests to be able to run it in JUnit