refactor handler test