@Test() public void testShouldNotBeAbleToExtractMainActivity() throws Exception { AndroidApp app = new DefaultAndroidApp(new File(INVALID_APK_FILE)); try { app.getMainActivity(); Assert.fail("On an invalid apk the main activity should not be found."); } catch (SelendroidException e) { } }
@Override public String getMainActivity() throws AndroidSdkException { if (mainActivity == null) { try { mainActivity = extractApkDetails("launchable-activity: name='(.*?)'"); } catch (ShellCommandException e) { throw new SelendroidException("The main activity of the apk " + apkFile.getName() + " cannot be extracted."); } } return mainActivity; }
DefaultAndroidApp implements AndroidApp { @Override public String getMainActivity() throws AndroidSdkException { if (mainActivity == null) { try { mainActivity = extractApkDetails("launchable-activity: name='(.*?)'"); } catch (ShellCommandException e) { throw new SelendroidException("The main activity of the apk " + apkFile.getName() + " cannot be extracted."); } } return mainActivity; } }
DefaultAndroidApp implements AndroidApp { @Override public String getMainActivity() throws AndroidSdkException { if (mainActivity == null) { try { mainActivity = extractApkDetails("launchable-activity: name='(.*?)'"); } catch (ShellCommandException e) { throw new SelendroidException("The main activity of the apk " + apkFile.getName() + " cannot be extracted."); } } return mainActivity; } DefaultAndroidApp(File apkFile); }
DefaultAndroidApp implements AndroidApp { @Override public String getMainActivity() throws AndroidSdkException { if (mainActivity == null) { try { mainActivity = extractApkDetails("launchable-activity: name='(.*?)'"); } catch (ShellCommandException e) { throw new SelendroidException("The main activity of the apk " + apkFile.getName() + " cannot be extracted."); } } return mainActivity; } 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 getMainActivity() throws AndroidSdkException { if (mainActivity == null) { try { mainActivity = extractApkDetails("launchable-activity: name='(.*?)'"); } catch (ShellCommandException e) { throw new SelendroidException("The main activity of the apk " + apkFile.getName() + " cannot be extracted."); } } return mainActivity; } 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();  }