@SuppressWarnings("rawtypes") @Test public void fail_pullFile() throws Exception { SyncService syncservice = Mockito.mock(SyncService.class); Mockito.doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { throw new IOException("its Mocking!"); } }).when(syncservice).pullFile(Mockito.anyString(), Mockito.anyString(), (ISyncProgressMonitor) Mockito.any()); boolean success = adbService.pullFile(syncservice, "remote", "file", "local"); assertTrue(!success); }
public boolean pullFile(SyncService service, String remotePath, String file, String localFolder) { try { service.pullFile( remotePath + file , localFolder + "/" + file , SyncService.getNullProgressMonitor()); } catch (SyncException | TimeoutException | IOException e) { LOGGER.error("pull " + file + ":" + e.getMessage()); return false; } return true; }
AdbServiceImpl implements IAdbService { public boolean pullFile(SyncService service, String remotePath, String file, String localFolder) { try { service.pullFile( remotePath + file , localFolder + "/" + file , SyncService.getNullProgressMonitor()); } catch (SyncException | TimeoutException | IOException e) { LOGGER.error("pull " + file + ":" + e.getMessage()); return false; } return true; } }
AdbServiceImpl implements IAdbService { public boolean pullFile(SyncService service, String remotePath, String file, String localFolder) { try { service.pullFile( remotePath + file , localFolder + "/" + file , SyncService.getNullProgressMonitor()); } catch (SyncException | TimeoutException | IOException e) { LOGGER.error("pull " + file + ":" + e.getMessage()); return false; } return true; }  }
AdbServiceImpl implements IAdbService { public boolean pullFile(SyncService service, String remotePath, String file, String localFolder) { try { service.pullFile( remotePath + file , localFolder + "/" + file , SyncService.getNullProgressMonitor()); } catch (SyncException | TimeoutException | IOException e) { LOGGER.error("pull " + file + ":" + e.getMessage()); return false; } return true; }  @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 { public boolean pullFile(SyncService service, String remotePath, String file, String localFolder) { try { service.pullFile( remotePath + file , localFolder + "/" + file , SyncService.getNullProgressMonitor()); } catch (SyncException | TimeoutException | IOException e) { LOGGER.error("pull " + file + ":" + e.getMessage()); return false; } return true; }  @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);  }