### Question:
AssetRenditionsZipperImpl implements AssetRenditionsDownloadOrchestrator { protected String getZipEntryName(final String folderName, final AssetModel asset, final String renditionName, final String responseContentType, final Set<String> zipEntryFileNames) { final String extension = mimeTypeService.getExtension(responseContentType); final Map<String, String> variables = new HashMap<>(); variables.put(VAR_ASSET_FILE_NAME, asset.getName()); variables.put(VAR_ASSET_NAME, StringUtils.substringBeforeLast(asset.getName(), ".")); variables.put(VAR_ASSET_TITLE, asset.getTitle()); variables.put(VAR_ASSET_EXTENSION, StringUtils.substringAfterLast(asset.getName(), ".")); variables.put(VAR_RENDITION_NAME, renditionName); variables.put(VAR_RENDITION_EXTENSION, extension); String zipEntryName = StringUtils.replaceEach(cfg.rendition_filename_expression(), variables.keySet().toArray(new String[variables.keySet().size()]), variables.values().toArray(new String[variables.values().size()])); zipEntryName = generateUniqueZipEntry(zipEntryName, zipEntryFileNames); if (folderName != null) { zipEntryFileNames.add(folderName + "/" + zipEntryName); } else { zipEntryFileNames.add(zipEntryName); } return zipEntryName; }  @Override void execute(final SlingHttpServletRequest request,
                        final SlingHttpServletResponse response,
                        final List<AssetModel> assets,
                        final List<String> renditionNames); @Override boolean accepts(SlingHttpServletRequest request, List<AssetModel> assets, List<String> renditionNames); static final String NAME; static final String VAR_ASSET_NAME; static final String VAR_ASSET_EXTENSION; static final String VAR_RENDITION_NAME; static final String VAR_RENDITION_EXTENSION; static final String VAR_ASSET_FILE_NAME; static final String VAR_ASSET_TITLE; static final String ZIP_EXTENSION; static final String DEFAULT_NO_CONTENT_FILE_NAME; static final String DEFAULT_NO_CONTENT_MESSAGE; }### Answer:
@Test public void getZipEntryName() { final String expected = "test__my-rendition.png"; ctx.registerInjectActivateService(new AssetRenditionsZipperImpl(), "rendition.filename.expression", AssetRenditionsZipperImpl.VAR_ASSET_NAME + "__" + AssetRenditionsZipperImpl.VAR_RENDITION_NAME + "." + AssetRenditionsZipperImpl.VAR_ASSET_EXTENSION ); AssetRenditionsZipperImpl zipper = (AssetRenditionsZipperImpl) ctx.getService(AssetRenditionsDownloadOrchestrator.class); AssetModel asset = modelFactory.getModelFromWrappedRequest(ctx.request(), ctx.resourceResolver().getResource("/content/dam/test.png"), AssetModel.class); final String actual = zipper.getZipEntryName("", asset, "my-rendition", "image/png", new HashSet<>()); assertEquals( expected, actual); }
@Test public void getZipEntryName_GenerateUniqueZipFileNameEntry() { final String expected = "1-test__my-rendition.png"; final Set<String> zipEntryFileNames = new HashSet<>(); zipEntryFileNames.add("test__my-rendition.png"); ctx.registerInjectActivateService(new AssetRenditionsZipperImpl(), "rendition.filename.expression", AssetRenditionsZipperImpl.VAR_ASSET_NAME + "__" + AssetRenditionsZipperImpl.VAR_RENDITION_NAME + "." + AssetRenditionsZipperImpl.VAR_ASSET_EXTENSION ); AssetRenditionsZipperImpl zipper = (AssetRenditionsZipperImpl) ctx.getService(AssetRenditionsDownloadOrchestrator.class); AssetModel asset = modelFactory.getModelFromWrappedRequest(ctx.request(), ctx.resourceResolver().getResource("/content/dam/test.png"), AssetModel.class); final String actual = zipper.getZipEntryName("", asset, "my-rendition", "image/png", zipEntryFileNames); assertEquals( expected, actual); }