Refactor the method test