PKPassTemplateFolder implements IPKPassTemplate { @Override public Map<String, ByteBuffer> getAllFiles() throws IOException { Map<String, ByteBuffer> allFiles = new HashMap<>(); String base = templateDir.getCanonicalPath(); for (File file : FileUtils.listFiles(templateDir, new RegexFileFilter("^(?!\\.).*"), TrueFileFilter.TRUE)) { byte[] byteArray = IOUtils.toByteArray(new FileInputStream(file)); String filePath = file.getCanonicalPath().substring(base.length() + 1); LOGGER.debug("File's own path: {}", filePath); allFiles.put(filePath, ByteBuffer.wrap(byteArray)); } return allFiles; } PKPassTemplateFolder(URL fileUrlOfTemplateDirectory);  PKPassTemplateFolder(String pathToTemplateDirectory); @Override void provisionPassAtDirectory(File tempPassDir); @Override Map<String, ByteBuffer> getAllFiles();  }
@Test public void test_getAllFiles() throws IOException, URISyntaxException { Map<String, ByteBuffer> allFiles = pkPassTemplateFolder.getAllFiles(); Assert.assertNotNull(allFiles); Assert.assertEquals(allFiles.size(), 8); File templateFolder = new File(PASS_TEMPLATE_FOLDER); for (Entry<String, ByteBuffer> entry : allFiles.entrySet()) { File file = new File(templateFolder, entry.getKey()); Assert.assertTrue(file.exists()); Assert.assertTrue(entry.getValue().remaining() > 0); } }