### Question:
LogHandler { public static UrlParts splitUrl(String url) throws MalformedURLException { new URL(url); String regexWithEvalId = "http.+/(.+Service)/(.+)/.+/(.+)/.+\\.(.+)$"; String regexWithOutEvalId = "http.+/(.+Service)/.+/(.+)/.+\\.(.+)$"; UrlParts parts = new UrlParts(); if (url.matches(regexWithEvalId)) { Matcher matcher = Pattern.compile(regexWithEvalId).matcher(url); matcher.find(); parts.service = matcher.group(1); parts.evalId = matcher.group(2); parts.port = matcher.group(3); parts.extension = matcher.group(4); } else { if (url.matches(regexWithOutEvalId)) { Matcher matcher = Pattern.compile(regexWithOutEvalId).matcher(url); matcher.find(); parts.service = matcher.group(1); parts.port = matcher.group(2); parts.extension = matcher.group(3); } else { throw new MalformedURLException( "URL does not match the required pattern. Example: http: } } return parts; }  static List<URL> getUrls(ToolResults logs); static long getTime(List<String> logs); static boolean hasInputUrl(String log); static boolean isLog(String s); static UrlParts splitUrl(String url); static String serviceName(String log); static String evaluationId(String log);  }### Answer:
@Test public void testSplitUrl() throws MalformedURLException { UrlParts parts = LogHandler .splitUrl("http: assertEquals("MyService", parts.service); assertEquals("outputFile", parts.port); assertEquals("txt", parts.extension); assertEquals("", parts.evalId); UrlParts partsEval = LogHandler .splitUrl("http: assertEquals("MyService", partsEval.service); assertEquals("", partsEval.evalId); UrlParts partsEvalWithUnderscores = LogHandler .splitUrl("http: assertEquals("", partsEvalWithUnderscores.evalId); UrlParts partsEval2 = LogHandler .splitUrl("http: }
@Test(expected = MalformedURLException.class) public void testSplitUrlMalformed() throws MalformedURLException { LogHandler.splitUrl("http }
@Test(expected = MalformedURLException.class) public void testSplitUrlBadFormat() throws MalformedURLException { LogHandler.splitUrl("http: }