Rewrite Junit tests