/**
  * Test of toAbsolute method, of class URLParser.
  *
  * @throws java.lang.Exception
  */
 @Test
 public void testToAbsolute_String_String() throws Exception {
   logger.info("toAbsolute");
   String base =
       "http://*****:*****@www.example.com:8080/to/path/document?arg1=val1&arg2=val2#part";
   String relative = "../path2/doc2?a=1&b=2#part2";
   String expResult = "http://*****:*****@www.example.com:8080/to/path2/doc2?a=1&b=2#part2";
   String result = URLParser.toAbsolute(base, relative);
   assertEquals(expResult, result);
 }
  /** Test of splitDomain method, of class URLParser. */
  @Test
  public void testSplitDomain1() {
    logger.info("splitDomain1");
    String domain = "www.cars.example.co.uk";
    Map<URLParser.DomainParts, String> expResult = new HashMap<>();
    expResult.put(URLParser.DomainParts.TLD, "co.uk");
    expResult.put(URLParser.DomainParts.DOMAINNAME, "example");
    expResult.put(URLParser.DomainParts.SUBDOMAIN, "www.cars");

    Map<URLParser.DomainParts, String> result = URLParser.splitDomain(domain);
    assertEquals(expResult, result);
  }
  /**
   * Test of joinURL method, of class URLParser.
   *
   * @throws java.lang.Exception
   */
  @Test
  public void testJoinURL() throws Exception {
    logger.info("joinURL");
    Map<URLParser.URLParts, String> urlParts = new HashMap<>();
    urlParts.put(URLParser.URLParts.PROTOCOL, "http");
    urlParts.put(URLParser.URLParts.PATH, "/to/path/document");
    urlParts.put(URLParser.URLParts.HOST, "www.example.com");
    urlParts.put(URLParser.URLParts.PORT, "8080");
    urlParts.put(URLParser.URLParts.USERINFO, "user:password");
    urlParts.put(URLParser.URLParts.FILENAME, "/to/path/document?arg1=val1&arg2=val2");
    urlParts.put(URLParser.URLParts.QUERY, "arg1=val1&arg2=val2");
    urlParts.put(URLParser.URLParts.AUTHORITY, "user:[email protected]:8080");
    urlParts.put(URLParser.URLParts.REF, "part");

    String expResult =
        "http://*****:*****@www.example.com:8080/to/path/document?arg1=val1&arg2=val2#part";
    String result = URLParser.joinURL(urlParts);
    assertEquals(expResult, result);
  }