LocalResourcePackFile implements TemplatePack { @Override public List<String> getTemplateNames() { List<String> unfilteredTemplateFiles = newArrayList(); for (String absoluteFilename : new IOUtil().listFiles(new File(this.packAbsolutePath))) { unfilteredTemplateFiles.add(remove(absoluteFilename)); } Collections.sort(unfilteredTemplateFiles); return unfilteredTemplateFiles; } LocalResourcePackFile(TemplatePackInfo templatePackInfo, File packRoot); @Override String getName(); TemplatePackInfo getTemplatePackInfo(); @Override List<String> getTemplateNames(); @Override Template getTemplateByName(String template);  }
@Test public void folderWithOneFile() throws IOException { TemplatePack pack = new LocalResourcePackFile(new TemplatePackInfo("dummy"), new File("src/test/resources/templates/1-file")); assertThat(pack.getTemplateNames()).hasSize(1); }
@Test public void folderWithTwoFiles() throws IOException { TemplatePack pack = new LocalResourcePackFile(new TemplatePackInfo("dummy"), new File("src/test/resources/templates/2-files")); assertThat(pack.getTemplateNames()).hasSize(2); }
@Test public void folderWithTwoFilesAndABakFile() throws IOException { TemplatePack pack = new LocalResourcePackFile(new TemplatePackInfo("dummy"), new File("src/test/resources/templates/2-files-and-1-bak-file")); assertThat(pack.getTemplateNames()).hasSize(2); }
@Test public void folderWithThreeFilesAndSubFolder() throws IOException { TemplatePack pack = new LocalResourcePackFile(new TemplatePackInfo("dummy"), new File("src/test/resources/templates/3-files-subfolder")); assertThat(pack.getTemplateNames()).hasSize(3); }