### Question:
ResourceLocator { @FromString public static ResourceLocator of(String locator) { ArgChecker.notNull(locator, "locator"); try { if (locator.startsWith(CLASSPATH_URL_PREFIX)) { String urlStr = locator.substring(CLASSPATH_URL_PREFIX.length()); return ofClasspath(urlStr); } else if (locator.startsWith(FILE_URL_PREFIX)) { String fileStr = locator.substring(FILE_URL_PREFIX.length()); return ofFile(new File(fileStr)); } else if (locator.startsWith(URL_PREFIX)) { String pathStr = locator.substring(URL_PREFIX.length()); return ofUrl(new URL(pathStr)); } else { return ofFile(new File(locator)); } } catch (Exception ex) { throw new IllegalArgumentException("Invalid resource locator: " + locator, ex); } } private  ResourceLocator(String locator, BeanByteSource source); @FromString static ResourceLocator of(String locator); static ResourceLocator ofFile(File file); static ResourceLocator ofPath(Path path); static ResourceLocator ofUrl(URL url); static ResourceLocator ofClasspath(String resourceName); static ResourceLocator ofClasspath(Class<?> cls, String resourceName); static ResourceLocator ofClasspathUrl(URL url); String getLocator(); BeanByteSource getByteSource(); CharSource getCharSource(); CharSource getCharSource(Charset charset); @Override boolean equals(Object obj); @Override int hashCode(); @ToString @Override String toString(); static final String CLASSPATH_URL_PREFIX; static final String FILE_URL_PREFIX; static final String URL_PREFIX; }### Answer:
@Test public void test_of_invalid() throws Exception { assertThatIllegalArgumentException().isThrownBy(() -> ResourceLocator.of("classpath:http:https:file:/foobar.txt")); }