@Test public void canAcquireFileResources() { String filePath = ResourceFactoryTest.class.getResource("/com/hotels/styx/common/io/resource.txt").getPath(); Resource resource = ResourceFactory.newResource(filePath); assertThat(resource, contains("This is an example resource.\nIt has content to use in automated tests.")); }
public static Resource newResource(String path, ClassLoader classLoader) { if (path.startsWith(CLASSPATH_SCHEME)) { return new ClasspathResource(path, classLoader); } return new FileResource(path); }
ResourceFactory { public static Resource newResource(String path, ClassLoader classLoader) { if (path.startsWith(CLASSPATH_SCHEME)) { return new ClasspathResource(path, classLoader); } return new FileResource(path); } }
ResourceFactory { public static Resource newResource(String path, ClassLoader classLoader) { if (path.startsWith(CLASSPATH_SCHEME)) { return new ClasspathResource(path, classLoader); } return new FileResource(path); }  }
ResourceFactory { public static Resource newResource(String path, ClassLoader classLoader) { if (path.startsWith(CLASSPATH_SCHEME)) { return new ClasspathResource(path, classLoader); } return new FileResource(path); }  static Resource newResource(String path, ClassLoader classLoader); static Resource newResource(String path); }
ResourceFactory { public static Resource newResource(String path, ClassLoader classLoader) { if (path.startsWith(CLASSPATH_SCHEME)) { return new ClasspathResource(path, classLoader); } return new FileResource(path); }  static Resource newResource(String path, ClassLoader classLoader); static Resource newResource(String path);  }