Refactor tests