PKPassTemplateInMemory implements IPKPassTemplate { public void addAllFiles(String directoryWithFilesToAdd) throws IOException { File directoryWithFilesToAddAsFile = new File(directoryWithFilesToAdd); if (!directoryWithFilesToAddAsFile.isDirectory()) { throw new IllegalArgumentException("Provided file is not a directory"); } Path pathToSourceFolder = Paths.get(directoryWithFilesToAddAsFile.getAbsolutePath()); Collection<File> filesInDir = FileUtils.listFiles(directoryWithFilesToAddAsFile, new RegexFileFilter("^(?!\\.).*"), TrueFileFilter.TRUE); for (File file : filesInDir) { Path relativePathOfFile = pathToSourceFolder.relativize(Paths.get(file.getAbsolutePath())); addFile(relativePathOfFile.toString(), file); } }  @Override void provisionPassAtDirectory(File tempPassDir); @Override Map<String, ByteBuffer> getAllFiles(); void addFile(String pathInTemplate, InputStream stream); void addFile(String pathInTemplate, File file); void addFile(String pathInTemplate, CharSequence content); void addFile(String pathInTemplate, URL contentURL); void addFile(String pathInTemplate, Locale locale, File file); void addFile(String pathInTemplate, Locale locale, InputStream stream); void addFile(String pathInTemplate, Locale locale, CharSequence content); void addFile(String pathInTemplate, Locale locale, URL contentURL); void addAllFiles(String directoryWithFilesToAdd); @Deprecated Map<String, InputStream> getFiles(); static final String PK_ICON_RETINAHD; static final String PK_ICON_RETINA; static final String PK_ICON; static final String PK_LOGO_RETINAHD; static final String PK_LOGO_RETINA; static final String PK_LOGO; static final String PK_THUMBNAIL_RETINAHD; static final String PK_THUMBNAIL_RETINA; static final String PK_THUMBNAIL; static final String PK_STRIP_RETINAHD; static final String PK_STRIP_RETINA; static final String PK_STRIP; static final String PK_BACKGROUND_RETINAHD; static final String PK_BACKGROUND_RETINA; static final String PK_BACKGROUND; static final String PK_FOOTER_RETINAHD; static final String PK_FOOTER_RETINA; static final String PK_FOOTER; static final String PK_PERSONALIZATION_LOGO_RETINAHD; static final String PK_PERSONALIZATION_LOGO_RETINA; static final String PK_PERSONALIZATION_LOGO; }
@Test public void addAllFiles() throws IOException { pkPassTemplateInMemory.addAllFiles(PASS_TEMPLATE_FOLDER); Map<String, ByteBuffer> files = pkPassTemplateInMemory.getAllFiles(); Assert.assertEquals(files.size(), 8); }