PKPassTemplateInMemory implements IPKPassTemplate { @Override public void provisionPassAtDirectory(File tempPassDir) throws IOException { for (Entry<String, byte[]> entry : files.entrySet()) { File pathToFile = new File(tempPassDir, entry.getKey()); FileUtils.copyInputStreamToFile(new ByteArrayInputStream(entry.getValue()), pathToFile); } }  @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 provisionPass() throws IOException { prepareTemplate(); File tempPassDir = Files.createTempDir(); pkPassTemplateInMemory.provisionPassAtDirectory(tempPassDir); Collection<File> createdFiles = FileUtils.listFiles(tempPassDir, new RegexFileFilter("^(.*?)"), DirectoryFileFilter.DIRECTORY); Assert.assertEquals(createdFiles.size(), 2); }