### Question:
OAuthService { Uri parseAuthorizationUrl(Element child, Uri base) throws SpecParserException { Uri url = XmlUtil.getHttpUriAttribute(child, URL_ATTR, base); if (url == null) { throw new SpecParserException("OAuth/Service/Authorization @url is not valid: " + child.getAttribute(URL_ATTR)); } return base.resolve(url); } OAuthService();  OAuthService(Element serviceElement, Uri base); EndPoint getRequestUrl(); EndPoint getAccessUrl(); Uri getAuthorizationUrl(); String getName();  }### Answer:
@Test public void testParseAuthorizeUrl() throws Exception { String xml = "<Authorization url='http: Uri url = service.parseAuthorizationUrl(XmlUtil.parse(xml), SPEC_URL); assertEquals("http: }
@Test(expected=SpecParserException.class) public void testParseAuthorizeUrl_nourl() throws Exception { String xml = "<Authorization/>"; service.parseAuthorizationUrl(XmlUtil.parse(xml), SPEC_URL); }
@Test public void testParseAuthorizeUrl_extraAttr() throws Exception { String xml = "<Authorization url='http: Uri url = service.parseAuthorizationUrl(XmlUtil.parse(xml), SPEC_URL); assertEquals("http: }
@Test public void testParseAuthorizeUrl_notHttp() throws Exception { OAuthService service = new OAuthService(); String xml = "<Authorization url='ftp: try { service.parseAuthorizationUrl(XmlUtil.parse(xml), SPEC_URL); fail("Should have rejected malformed Authorization element"); } catch (SpecParserException e) { assertEquals("OAuth/Service/Authorization @url is not valid: ftp: } }