@Test public void testGetUrlFromString() throws Exception { List<URL> urls = parser.getUrlsFromObject("http: Assert.assertEquals(1, urls.size()); for (URL url : urls) { Assert.assertEquals("http: } }
public List<URL> getUrlsFromObject(Object urlsObject) throws MalformedURLException, URISyntaxException { if (urlsObject instanceof String) { return Arrays.asList(uriFromString((String) urlsObject).toURL()); } if (urlsObject instanceof Iterable<?>) { List<URL> urls = new ArrayList<URL>(); for (Object urlObj : (Iterable<?>) urlsObject) { urls.addAll(getUrlsFromObject(urlObj)); } return urls; } return new ArrayList<URL>(); }
UriParser { public List<URL> getUrlsFromObject(Object urlsObject) throws MalformedURLException, URISyntaxException { if (urlsObject instanceof String) { return Arrays.asList(uriFromString((String) urlsObject).toURL()); } if (urlsObject instanceof Iterable<?>) { List<URL> urls = new ArrayList<URL>(); for (Object urlObj : (Iterable<?>) urlsObject) { urls.addAll(getUrlsFromObject(urlObj)); } return urls; } return new ArrayList<URL>(); } }
UriParser { public List<URL> getUrlsFromObject(Object urlsObject) throws MalformedURLException, URISyntaxException { if (urlsObject instanceof String) { return Arrays.asList(uriFromString((String) urlsObject).toURL()); } if (urlsObject instanceof Iterable<?>) { List<URL> urls = new ArrayList<URL>(); for (Object urlObj : (Iterable<?>) urlsObject) { urls.addAll(getUrlsFromObject(urlObj)); } return urls; } return new ArrayList<URL>(); }  }
UriParser { public List<URL> getUrlsFromObject(Object urlsObject) throws MalformedURLException, URISyntaxException { if (urlsObject instanceof String) { return Arrays.asList(uriFromString((String) urlsObject).toURL()); } if (urlsObject instanceof Iterable<?>) { List<URL> urls = new ArrayList<URL>(); for (Object urlObj : (Iterable<?>) urlsObject) { urls.addAll(getUrlsFromObject(urlObj)); } return urls; } return new ArrayList<URL>(); }  URI uriFromString(String s); List<URL> getUrlsFromObject(Object urlsObject); }
UriParser { public List<URL> getUrlsFromObject(Object urlsObject) throws MalformedURLException, URISyntaxException { if (urlsObject instanceof String) { return Arrays.asList(uriFromString((String) urlsObject).toURL()); } if (urlsObject instanceof Iterable<?>) { List<URL> urls = new ArrayList<URL>(); for (Object urlObj : (Iterable<?>) urlsObject) { urls.addAll(getUrlsFromObject(urlObj)); } return urls; } return new ArrayList<URL>(); }  URI uriFromString(String s); List<URL> getUrlsFromObject(Object urlsObject);  }