public void testGenerateAppList() throws Exception {
      mTestInstance.setupAppInfos();
      assertEquals(2, mTestInstance.mAppInfos.size());

      assertTrue(mTestInstance.generateAppList().contains("App 1,app1\n"));
      assertTrue(mTestInstance.generateAppList().contains("App 2,key2\n"));
    }
  /** {@inheritDoc} */
  @Override
  public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
    Assert.assertNotNull(mTestDevice);

    mAppListPath =
        new File(mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE), APP_LIST_FILE)
            .getAbsolutePath();
    mAppOutputPath =
        new File(mTestDevice.getMountPoint(IDevice.MNT_EXTERNAL_STORAGE), APP_OUTPUT_FILE)
            .getAbsolutePath();

    setupAppInfos();

    // Setup the device
    mTestDevice.executeShellCommand(String.format("rm %s %s", mAppListPath, mAppOutputPath));
    mTestDevice.pushString(generateAppList(), mAppListPath);
    mTestDevice.executeShellCommand(String.format("chmod 750 %s", APP_LAUNCH));

    // Sleep 30 seconds to let device settle.
    RunUtil.getDefault().sleep(30 * 1000);

    // Run the test
    String output = mTestDevice.executeShellCommand(APP_LAUNCH);

    CLog.d("App launch output: %s", output);
    logOutputFile(listener);
  }
    public void testParseOutputFile_fail() throws Exception {
      mTestInstance.setupAppInfos();
      assertEquals(2, mTestInstance.mAppInfos.size());

      mTestInstance.parseOutputFile("app1|1234\n");
      assertTrue(mTestInstance.shouldTakeBugreport());
      assertEquals(new Integer(1234), mTestInstance.mAppInfos.get("app1").getTime());
      assertNull(mTestInstance.mAppInfos.get("app2").getTime());
    }
 public void testSetupAppInfos() throws Exception {
   mTestInstance.setupAppInfos();
   assertEquals(2, mTestInstance.mAppInfos.size());
   assertNotNull(mTestInstance.mAppInfos.get("app1"));
   assertEquals("App 1", mTestInstance.mAppInfos.get("app1").getName());
   assertEquals("app1", mTestInstance.mAppInfos.get("app1").getOutputKey());
   assertEquals("app1", mTestInstance.mAppInfos.get("app1").getPostKey());
   assertNotNull(mTestInstance.mAppInfos.get("app2"));
   assertEquals("App 2", mTestInstance.mAppInfos.get("app2").getName());
   assertEquals("app2", mTestInstance.mAppInfos.get("app2").getOutputKey());
   assertEquals("key2", mTestInstance.mAppInfos.get("app2").getPostKey());
 }