@Test
public void canImportToFilesystem() throws IOException {
// Given
ResourceIndexer indexer = mock(ResourceIndexer.class);
ResourceLoader loader = mock(ResourceLoader.class);
String rootURI = "http://wiki";
Map<String, Resource> index = new HashMap<String, Resource>();
index.put("one", new Resource(rootURI + "/one"));
index.put("two", new Resource(rootURI + "/two"));
when(indexer.indexResources(rootURI)).thenReturn(index);
String text1 = "story text 1";
when(loader.loadResourceAsText(index.get("one").getURI())).thenReturn(text1);
String text2 = "story text 2";
when(loader.loadResourceAsText(index.get("two").getURI())).thenReturn(text2);
// When
String targetPath = "target/stories";
String targetExt = ".story";
ResourceImporter importer = new ImportToFilesystem(indexer, loader, targetPath, targetExt);