Refactor tests into a separate class