@Test() public void testShouldNotBeAbleToExtractBasePackage() throws Exception { AndroidApp app = new DefaultAndroidApp(new File(INVALID_APK_FILE)); try { app.getBasePackage(); Assert.fail("On an invalid apk the base package should not be found."); } catch (SelendroidException e) { } }
@Override public String getBasePackage() throws AndroidSdkException { if (mainPackage == null) { try { mainPackage = extractApkDetails("package: name='(.*?)'"); } catch (ShellCommandException e) { throw new SelendroidException("The base package name of the apk " + apkFile.getName() + " cannot be extracted."); } } return mainPackage; }
DefaultAndroidApp implements AndroidApp { @Override public String getBasePackage() throws AndroidSdkException { if (mainPackage == null) { try { mainPackage = extractApkDetails("package: name='(.*?)'"); } catch (ShellCommandException e) { throw new SelendroidException("The base package name of the apk " + apkFile.getName() + " cannot be extracted."); } } return mainPackage; } }
DefaultAndroidApp implements AndroidApp { @Override public String getBasePackage() throws AndroidSdkException { if (mainPackage == null) { try { mainPackage = extractApkDetails("package: name='(.*?)'"); } catch (ShellCommandException e) { throw new SelendroidException("The base package name of the apk " + apkFile.getName() + " cannot be extracted."); } } return mainPackage; } DefaultAndroidApp(File apkFile); }
DefaultAndroidApp implements AndroidApp { @Override public String getBasePackage() throws AndroidSdkException { if (mainPackage == null) { try { mainPackage = extractApkDetails("package: name='(.*?)'"); } catch (ShellCommandException e) { throw new SelendroidException("The base package name of the apk " + apkFile.getName() + " cannot be extracted."); } } return mainPackage; } DefaultAndroidApp(File apkFile); @Override String getBasePackage(); @Override String getMainActivity(); void setMainActivity(String mainActivity); @Override void deleteFileFromWithinApk(String file); @Override String getAbsolutePath(); @Override String getVersionName(); String getAppId(); }
DefaultAndroidApp implements AndroidApp { @Override public String getBasePackage() throws AndroidSdkException { if (mainPackage == null) { try { mainPackage = extractApkDetails("package: name='(.*?)'"); } catch (ShellCommandException e) { throw new SelendroidException("The base package name of the apk " + apkFile.getName() + " cannot be extracted."); } } return mainPackage; } DefaultAndroidApp(File apkFile); @Override String getBasePackage(); @Override String getMainActivity(); void setMainActivity(String mainActivity); @Override void deleteFileFromWithinApk(String file); @Override String getAbsolutePath(); @Override String getVersionName(); String getAppId();  }