### Question:
UrlListExtractor { public static List<String> extract(UrlList urlList) { Validate.notNull(urlList, "URL list is null"); List<String> urls = new ArrayList<>(urlList.size()); for (int i = 0; i < urlList.size(); i++) { String url = urlList.current(); urls.add(url); urlList.fail(url); } return urls; } private  UrlListExtractor(); static List<String> extract(UrlList urlList);  }### Answer:
@Test public void testUrlsExtractedFromMultipleElementsList() throws Exception { UrlList urlList = new UrlList(Arrays.asList("url1", "url2", "url3")); List<String> urls = UrlListExtractor.extract(urlList); Assert.assertNotNull(urls); Assert.assertEquals(3, urls.size()); Assert.assertTrue(urls.contains("url1")); Assert.assertTrue(urls.contains("url2")); Assert.assertTrue(urls.contains("url3")); }
@Test public void testUrlsExtractedFromOneElementList() throws Exception { UrlList urlList = new UrlList("url"); List<String> urls = UrlListExtractor.extract(urlList); Assert.assertEquals("url", urlList.current()); Assert.assertNotNull(urls); Assert.assertEquals(1, urls.size()); Assert.assertTrue(urls.contains("url")); }