extract common code in dispatcher tests