@Test public void continuesOnSpecificRequestErrorIfConfigured() throws Exception { printTestHeader("continuesOnSpecificRequestErrorIfConfigured"); setContinueOnError(true); StubSpecificRequestFailureSmartsheetService stubSmartsheetService = new StubSpecificRequestFailureSmartsheetService(); stubSmartsheetService.setMakeGetSheetRequestFail(true); SmartsheetBackupService backupService = new SmartsheetBackupService( new ErrorContextualizingSmartsheetService(stubSmartsheetService), parallelDownloadService); backupToTempDir(backupService); assertTrue(ProgressWatcher.getInstance().getErrorCount() > 0); String errorLogFile = ProgressWatcher.getInstance().getErrorLogFile(); assertNotNull(errorLogFile); printErrorLogFilePathWhenDone(errorLogFile); }
@Test public void doesNotContinueOnSpecificRequestErrorIfNotConfigured() { printTestHeader("doesNotContinueOnSpecificRequestErrorIfNotConfigured"); // setContinueOnError(false); - not needed because default value is already false StubSpecificRequestFailureSmartsheetService stubSmartsheetService = new StubSpecificRequestFailureSmartsheetService(); stubSmartsheetService.setMakeGetSheetRequestFail(true); SmartsheetBackupService backupService = new SmartsheetBackupService( new ErrorContextualizingSmartsheetService(stubSmartsheetService), parallelDownloadService); try { backupToTempDir(backupService); fail("Did not get exception even though continueOnError false"); } catch (Exception e) { assertTrue(e.getClass().equals(SmartsheetGetSheetDetailsException.class)); assertTrue(ProgressWatcher.getInstance().getErrorCount() > 0); } }