when a Uri is expected, validate it and populate it
refactor tests for some readability