only pre-pending root for path fragments

Fixed the to function of UrlGenerator to only pre-pend a root when the path is not a full url but just a fragment.
Also included a unit test assertion.