@Test public void runAdbCommandTest() throws IOException { Mockito.when(processRunner.runGetString(Mockito.anyString())).thenReturn("Test Command"); boolean adbCmdFlg = adbService.runAdbCommand(); assertTrue(adbCmdFlg); Mockito.when(processRunner.runGetString(Mockito.anyString())).thenReturn("Cannot run"); boolean adbCmdFlg1 = adbService.runAdbCommand(); assertTrue(!adbCmdFlg1); Mockito.when(processRunner.runGetString(Mockito.anyString())).thenReturn(""); boolean adbCmdFlg2 = adbService.runAdbCommand(); assertTrue(!adbCmdFlg2); }
boolean runAdbCommand() { String lines = ""; try { lines = extrunner.runGetString("adb devices"); } catch (IOException e) { LOGGER.error(e.getMessage()); } if (lines.contains("command not found") || lines.contains("not recognized") || lines.contains("No such file") || lines.contains("Cannot run")) { return false; } if (lines.length() > 0) { return true; } return false; }
AdbServiceImpl implements IAdbService { boolean runAdbCommand() { String lines = ""; try { lines = extrunner.runGetString("adb devices"); } catch (IOException e) { LOGGER.error(e.getMessage()); } if (lines.contains("command not found") || lines.contains("not recognized") || lines.contains("No such file") || lines.contains("Cannot run")) { return false; } if (lines.length() > 0) { return true; } return false; } }
AdbServiceImpl implements IAdbService { boolean runAdbCommand() { String lines = ""; try { lines = extrunner.runGetString("adb devices"); } catch (IOException e) { LOGGER.error(e.getMessage()); } if (lines.contains("command not found") || lines.contains("not recognized") || lines.contains("No such file") || lines.contains("Cannot run")) { return false; } if (lines.length() > 0) { return true; } return false; }  }
AdbServiceImpl implements IAdbService { boolean runAdbCommand() { String lines = ""; try { lines = extrunner.runGetString("adb devices"); } catch (IOException e) { LOGGER.error(e.getMessage()); } if (lines.contains("command not found") || lines.contains("not recognized") || lines.contains("No such file") || lines.contains("Cannot run")) { return false; } if (lines.length() > 0) { return true; } return false; }  @Autowired void setAndroid(IAndroid android); @Autowired void setExternalProcessRunner(IExternalProcessRunner runner); @Autowired void setFileExtactor(IReadWriteFileExtractor extractor); @Autowired void setFileManager(IFileManager fileManager); @Autowired void setAROConfigFile(Settings configFile); @Override boolean hasADBpath(); @Override String getAdbPath(); @Override String getAdbPath(boolean unfiltered); @Override boolean isAdbFileExist(); @Override AndroidDebugBridge initCreateBridge(String adbPath); @Override AndroidDebugBridge ensureADBServiceStarted(); @Override IDevice[] getConnectedDevices(); @Override FileEntry locate(IDevice device, FileEntry rootPath, String path); boolean pullFile(SyncService service, String remotePath, String file, String localFolder); @Override boolean installPayloadFile(IAroDevice aroDevice, String tempFolder, String payloadFileName, String remotepath); @Override boolean installPayloadFile(IDevice device, String tempFolder, String payloadFileName, String remotepath); @Override String[] getApplicationList(String id); }
AdbServiceImpl implements IAdbService { boolean runAdbCommand() { String lines = ""; try { lines = extrunner.runGetString("adb devices"); } catch (IOException e) { LOGGER.error(e.getMessage()); } if (lines.contains("command not found") || lines.contains("not recognized") || lines.contains("No such file") || lines.contains("Cannot run")) { return false; } if (lines.length() > 0) { return true; } return false; }  @Autowired void setAndroid(IAndroid android); @Autowired void setExternalProcessRunner(IExternalProcessRunner runner); @Autowired void setFileExtactor(IReadWriteFileExtractor extractor); @Autowired void setFileManager(IFileManager fileManager); @Autowired void setAROConfigFile(Settings configFile); @Override boolean hasADBpath(); @Override String getAdbPath(); @Override String getAdbPath(boolean unfiltered); @Override boolean isAdbFileExist(); @Override AndroidDebugBridge initCreateBridge(String adbPath); @Override AndroidDebugBridge ensureADBServiceStarted(); @Override IDevice[] getConnectedDevices(); @Override FileEntry locate(IDevice device, FileEntry rootPath, String path); boolean pullFile(SyncService service, String remotePath, String file, String localFolder); @Override boolean installPayloadFile(IAroDevice aroDevice, String tempFolder, String payloadFileName, String remotepath); @Override boolean installPayloadFile(IDevice device, String tempFolder, String payloadFileName, String remotepath); @Override String[] getApplicationList(String id);  }