DirectoryResource implements Resource { public File getRootDirectory() { return this.rootDirectory; } DirectoryResource();  DirectoryResource(String rootDirectory);  DirectoryResource(File rootDirectory); @Override URL getResource(String location); @Override InputStream getResourceAsStream(String location); @Override Stream<String> getAllLocations(); File getRootDirectory(); void setRootDirectory(File rootDirectory);  }
@Test void testGetRootDirectory() { DirectoryResource resource = new DirectoryResource(); resource.setRootDirectory(new File("src/main/java")); assertNotNull(resource.getRootDirectory()); }