Refactoring of assertUrl call