Refactor testing methods