### Question:
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);  }### Answer:
@Test public void canAcquireClasspathResources() { Resource resource = ResourceFactory.newResource("classpath:com/hotels/styx/common/io/resource.txt"); assertThat(resource, contains("This is an example resource.\nIt has content to use in automated tests.")); }
@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.")); }