### Question:
AssetRenditionsImpl implements AssetRenditions { @Override public String getUrl(final SlingHttpServletRequest request, final AssetModel asset, final AssetRenditionParameters parameters) { String url = request.getResourceResolver().map(asset.getPath()) + "." + AssetRenditionServlet.SERVLET_EXTENSION + "/" + parameters.getRenditionName() + "/"; if (parameters.isDownload()) { url += AssetRenditionParameters.DOWNLOAD + "/"; } url += AssetRenditionParameters.CACHE_FILENAME; return url; }  @Override String getUrl(final SlingHttpServletRequest request, final AssetModel asset, final AssetRenditionParameters parameters); @Override Map<String, String> getOptions(final Map<String, ? extends Object> mappings); @Override String evaluateExpression(final SlingHttpServletRequest request, String expression);  }### Answer:
@Test public void getUrl() { final String expected = "/content/dam/test.png.renditions/test-rendition/asset.rendition"; final AssetRenditions assetRenditions = ctx.getService(AssetRenditions.class); final AssetRenditionParameters params = new AssetRenditionParameters(testAssetModel, "test-rendition", false); final AssetModel assetModel = ctx.request().adaptTo(AssetModel.class); String actual = assetRenditions.getUrl(ctx.request(), assetModel, params); assertEquals(expected, actual); }
@Test public void getUrl_AsDownload() { final String expected = "/content/dam/test.png.renditions/test-rendition/download/asset.rendition"; final AssetRenditions assetRenditions = ctx.getService(AssetRenditions.class); final AssetRenditionParameters params = new AssetRenditionParameters(testAssetModel, "test-rendition", true); final AssetModel assetModel = ctx.request().adaptTo(AssetModel.class); String actual = assetRenditions.getUrl(ctx.request(), assetModel, params); assertEquals(expected, actual); }