refactor tests handlers