Improve Junit test robustness