AppViewManager { public Observable<DownloadModel> loadDownloadModel(String md5, String packageName, int versionCode, String signature, long storeId, boolean hasAppc) { return Observable.combineLatest(installManager.getInstall(md5, packageName, versionCode), appcMigrationManager.isMigrationApp(packageName, signature, versionCode, storeId, hasAppc), (install, isMigration) -> new DownloadModel( downloadStateParser.parseDownloadType(install.getType(), isMigration), install.getProgress(), downloadStateParser.parseDownloadState(install.getState(), install.isIndeterminate()))); } AppViewManager(AppViewModelManager appViewModelManager, InstallManager installManager,
      DownloadFactory downloadFactory, AppCenter appCenter, ReviewsManager reviewsManager,
      AdsManager adsManager, FlagManager flagManager, StoreUtilsProxy storeUtilsProxy,
      AptoideAccountManager aptoideAccountManager, MoPubAdsManager moPubAdsManager,
      DownloadStateParser downloadStateParser, AppViewAnalytics appViewAnalytics,
      NotificationAnalytics notificationAnalytics, InstallAnalytics installAnalytics, int limit,
      Scheduler ioScheduler, String marketName, AppCoinsManager appCoinsManager,
      PromotionsManager promotionsManager, AppcMigrationManager appcMigrationManager,
      LocalNotificationSyncManager localNotificationSyncManager,
      AppcPromotionNotificationStringProvider appcPromotionNotificationStringProvider); Observable<AppViewModel> observeAppViewModel(); Single<AppViewModel> getAppViewModel(); Single<AppModel> getAppModel(); Single<ReviewsViewModel> loadReviewsViewModel(String storeName, String packageName,
      String languagesFilterSort); Single<SimilarAppsViewModel> loadAppcSimilarAppsViewModel(String packageName,
      boolean isFromMature); Single<SimilarAppsViewModel> loadSimilarAppsViewModel(String packageName,
      List<String> keyWords, boolean isMature, boolean shouldLoadNativeAds); Single<SearchAdResult> loadAdsFromAppView(); Single<Boolean> flagApk(String storeName, String md5, FlagsVote.VoteType type); Completable subscribeStore(String storeName); SimilarAppsViewModel getCachedSimilarAppsViewModel(); boolean shouldShowRootInstallWarningPopup(); void allowRootInstall(Boolean answer); Completable downloadApp(DownloadModel.Action downloadAction, long appId,
      String trustedValue, String editorsChoicePosition,
      WalletAdsOfferManager.OfferResponseStatus status, boolean isApkfy); Completable downloadApp(WalletApp walletApp); void setupMigratorUninstallEvent(String packageName); Observable<DownloadModel> loadDownloadModel(String md5, String packageName,
      int versionCode, String signature, long storeId, boolean hasAppc); Completable pauseDownload(String md5); Completable resumeDownload(String md5, long appId, DownloadModel.Action action,
      String trustedBadge, boolean isApkfy); Completable cancelDownload(String md5, String packageName, int versionCode); SearchAdResult getSearchAdResult(); void setSearchAdResult(SearchAdResult searchAdResult); void handleAdsLogic(SearchAdResult searchAdResult); void sendAppOpenAnalytics(String packageName, String publisher, String badge,
      boolean hasBilling, boolean hasAdvertising); void sendEditorsAppOpenAnalytics(String packageName, String publisher, String badge,
      boolean hasBilling, boolean hasAdvertising, String editorsBrickPosition); String getMarketName(); Single<List<Donation>> getTopDonations(String packageName); Single<Boolean> shouldLoadInterstitialAd(String packageName); Single<Boolean> shouldLoadBannerAd(); Single<Boolean> shouldLoadNativeAds(); Observable<PromotionViewModel> loadPromotionViewModel(); boolean hasClaimablePromotion(Promotion.ClaimAction action); Promotion getClaimablePromotion(List<Promotion> promotions,
      Promotion.ClaimAction claimAction); SimilarAppsViewModel getCachedAppcSimilarAppsViewModel(); Observable<DownloadModel> downloadStarted(); boolean isAppcPromotionImpressionSent(); void setAppcPromotionImpressionSent(); boolean isMigrationImpressionSent(); void setMigrationImpressionSent(); void scheduleNotification(String appcValue, String image, String packageName,
      String storeName); void unscheduleNotificationSync(); Single<Boolean> shouldShowConsentDialog(); Single<WalletAdsOfferManager.OfferResponseStatus> getAdsVisibilityStatus();  }
@Test public void loadDownloadAppViewModelTest() { Install install = new Install(2, Install.InstallationStatus.DOWNLOADING, Install.InstallationType.INSTALL, false, 1, "md5", "packageName", 1, "", "", ""); when(installManager.getInstall("md5", "packageName", 1)).thenReturn(Observable.just(install)); when(migrationManager.isMigrationApp("packageName", "", 1, 2, false)).thenReturn( Observable.just(false)); DownloadModel downloadModel = appViewManager.loadDownloadModel("md5", "packageName", 1, "", 2, false) .toBlocking() .first(); verify(installManager).getInstall("md5", "packageName", 1); Assert.assertEquals(2, downloadModel.getProgress()); Assert.assertEquals(DownloadModel.Action.INSTALL, downloadModel.getAction()); Assert.assertEquals(DownloadModel.DownloadState.ACTIVE, downloadModel.getDownloadState()); }