Refactor the tests a bit