@Test public void testAmazonUndergroundInstallSourceIsParsedCorrectly() { final InstallSource installSource = InstallSource.fromInstallerPackageName("com.amazon.mshop.android"); assertTrue( "Package name is correctly identified as belonging to Amazon Underground", installSource instanceof AmazonUndergroundInstallSource); assertEquals( "Amazon Underground install source has correct description", "Amazon Underground", installSource.toString()); }
@NonNull static InstallSource fromInstallerPackageName(@Nullable final String installerPackageName) { if (GOOGLE_PLAY_STORE_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new GooglePlayStoreInstallSource(); } else if (AMAZON_APP_STORE_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new AmazonAppStoreInstallSource(); } else if (AMAZON_UNDERGROUND_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new AmazonUndergroundInstallSource(); } else if (PACKAGE_INSTALLER_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new PackageInstallerInstallSource(); } else if (installerPackageName != null) { return new UnrecognizedInstallSource(installerPackageName); } else { return new UnknownInstallSource(); } }
InstallSource { @NonNull static InstallSource fromInstallerPackageName(@Nullable final String installerPackageName) { if (GOOGLE_PLAY_STORE_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new GooglePlayStoreInstallSource(); } else if (AMAZON_APP_STORE_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new AmazonAppStoreInstallSource(); } else if (AMAZON_UNDERGROUND_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new AmazonUndergroundInstallSource(); } else if (PACKAGE_INSTALLER_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new PackageInstallerInstallSource(); } else if (installerPackageName != null) { return new UnrecognizedInstallSource(installerPackageName); } else { return new UnknownInstallSource(); } } }
InstallSource { @NonNull static InstallSource fromInstallerPackageName(@Nullable final String installerPackageName) { if (GOOGLE_PLAY_STORE_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new GooglePlayStoreInstallSource(); } else if (AMAZON_APP_STORE_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new AmazonAppStoreInstallSource(); } else if (AMAZON_UNDERGROUND_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new AmazonUndergroundInstallSource(); } else if (PACKAGE_INSTALLER_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new PackageInstallerInstallSource(); } else if (installerPackageName != null) { return new UnrecognizedInstallSource(installerPackageName); } else { return new UnknownInstallSource(); } } private  InstallSource(); }
InstallSource { @NonNull static InstallSource fromInstallerPackageName(@Nullable final String installerPackageName) { if (GOOGLE_PLAY_STORE_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new GooglePlayStoreInstallSource(); } else if (AMAZON_APP_STORE_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new AmazonAppStoreInstallSource(); } else if (AMAZON_UNDERGROUND_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new AmazonUndergroundInstallSource(); } else if (PACKAGE_INSTALLER_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new PackageInstallerInstallSource(); } else if (installerPackageName != null) { return new UnrecognizedInstallSource(installerPackageName); } else { return new UnknownInstallSource(); } } private  InstallSource();  }
InstallSource { @NonNull static InstallSource fromInstallerPackageName(@Nullable final String installerPackageName) { if (GOOGLE_PLAY_STORE_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new GooglePlayStoreInstallSource(); } else if (AMAZON_APP_STORE_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new AmazonAppStoreInstallSource(); } else if (AMAZON_UNDERGROUND_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new AmazonUndergroundInstallSource(); } else if (PACKAGE_INSTALLER_PACKAGE_NAME.equalsIgnoreCase(installerPackageName)) { return new PackageInstallerInstallSource(); } else if (installerPackageName != null) { return new UnrecognizedInstallSource(installerPackageName); } else { return new UnknownInstallSource(); } } private  InstallSource();   }