### Question:
DownloadImpl implements Download, ComponentExporter { @Deprecated protected boolean isLegacyMode() { if (legacyMode == null) { if (getAssetRenditionsGroups() != null && !getAssetRenditionsGroups().isEmpty()) { return false; } else { return excludeOriginalAssets != null; } } else { return legacyMode; } }  @Override List<AssetRenditionsGroup> getAssetRenditionsGroups(); Collection<AssetModel> getAssets(); String getZipFileName(); @Override long getMaxContentSize(); @Override long getDownloadContentSize(); @Override String getMaxContentSizeLabel(); @Override String getDownloadContentSizeLabel(); @Nonnull @Override String getExportedType(); static final String PN_ASSET_RENDITIONS_GROUP_TITLE; static final String NN_ASSET_RENDITIONS; static final String NN_ITEMS; }### Answer:
@Test public void isLegacyMode_Yes() { ctx.currentResource("/content/download_legacy"); final Download download = ctx.request().adaptTo(Download.class); assertTrue("Should be legacy mode", ((DownloadImpl)download).isLegacyMode()); }
@Test public void isLegacyMode_Yes_WithMode() { ctx.currentResource("/content/download_legacy_mode"); final Download download = ctx.request().adaptTo(Download.class); assertTrue("Should be legacy mode", ((DownloadImpl)download).isLegacyMode()); }
@Test public void isLegacyMode_No() { ctx.currentResource("/content/download"); final Download download = ctx.request().adaptTo(Download.class); assertFalse("Should be NOT be legacy mode", ((DownloadImpl)download).isLegacyMode()); }
@Test public void isLegacyMode_No_WithGroups() { ctx.currentResource("/content/download_with_asset_rendition_groups"); final Options group1Options = new TestOptionsImpl(ctx.currentResource().getChild("asset-renditions-groups/items/item0/asset-renditions/items")); final Options group2Options = new TestOptionsImpl(ctx.currentResource().getChild("asset-renditions-groups/items/item1/asset-renditions/items")); doReturn(group1Options).when(modelFactory).getModelFromWrappedRequest(eq(ctx.request()), argThat(new IsSameResourceByPath(ctx.currentResource().getChild("asset-renditions-groups/items/item0/asset-renditions").getPath())), eq(Options.class)); doReturn(group2Options).when(modelFactory).getModelFromWrappedRequest(eq(ctx.request()), argThat(new IsSameResourceByPath(ctx.currentResource().getChild("asset-renditions-groups/items/item1/asset-renditions").getPath())), eq(Options.class)); final Download download = ctx.request().adaptTo(Download.class); assertFalse("Should be NOT be legacy mode", ((DownloadImpl)download).isLegacyMode()); }