PKPassTemplateInMemory implements IPKPassTemplate { @Override public Map<String, ByteBuffer> getAllFiles() { Map<String, ByteBuffer> bufferMap = new HashMap<>(files.size()); for (Entry<String, byte[]> entry : files.entrySet()) { bufferMap.put(entry.getKey(), ByteBuffer.wrap(entry.getValue())); } return bufferMap; }  @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 test_getAllFiles() throws IOException, URISyntaxException { prepareTemplate(); Map<String, ByteBuffer> allFiles = pkPassTemplateInMemory.getAllFiles(); Assert.assertNotNull(allFiles); Assert.assertEquals(allFiles.size(), 2); for (Entry<String, ByteBuffer> entry : allFiles.entrySet()) { Assert.assertTrue(entry.getValue().remaining() > 0); } }
@Test public void test_getAllFilesShouldReturnTheExpectedResultAtSecondUse() throws IOException, URISyntaxException { prepareTemplate(); pkPassTemplateInMemory.getAllFiles(); Map<String, ByteBuffer> allFiles = pkPassTemplateInMemory.getAllFiles(); Assert.assertNotNull(allFiles); Assert.assertEquals(allFiles.size(), 2); for (Entry<String, ByteBuffer> entry : allFiles.entrySet()) { Assert.assertTrue(entry.getValue().remaining() > 0); } }