@Test public void saveHttpLogs_should_not_fail_but_return_null_on_write_failure() { when(araConfiguration.getFileHomeFolder()).thenReturn("/bin/mkdir/?/not-writable"); when(araConfiguration.getFileHttpLogsSubFolder()).thenReturn("/directory"); final String url = cut.saveHttpLogs("any"); assertThat(url).isNull(); }
@Override public String saveHttpLogs(String html) { try { final String subFolder = araConfiguration.getFileHttpLogsSubFolder(); final String absoluteFolderPath = araConfiguration.getFileHomeFolder() + subFolder; final String fileName = fileNameService.generateReportFileName("http-log", "html"); final File file = new File(absoluteFolderPath + File.separator + fileName); FileUtils.write(file, html, StandardCharsets.UTF_8); return araConfiguration.getFileHttpAccess() + subFolder + "/" + fileName; } catch (IOException e) { log.error("HTTP log saving failed: {}", e.getMessage(), e); return null; } }
FileAssetService implements AssetService { @Override public String saveHttpLogs(String html) { try { final String subFolder = araConfiguration.getFileHttpLogsSubFolder(); final String absoluteFolderPath = araConfiguration.getFileHomeFolder() + subFolder; final String fileName = fileNameService.generateReportFileName("http-log", "html"); final File file = new File(absoluteFolderPath + File.separator + fileName); FileUtils.write(file, html, StandardCharsets.UTF_8); return araConfiguration.getFileHttpAccess() + subFolder + "/" + fileName; } catch (IOException e) { log.error("HTTP log saving failed: {}", e.getMessage(), e); return null; } } }
FileAssetService implements AssetService { @Override public String saveHttpLogs(String html) { try { final String subFolder = araConfiguration.getFileHttpLogsSubFolder(); final String absoluteFolderPath = araConfiguration.getFileHomeFolder() + subFolder; final String fileName = fileNameService.generateReportFileName("http-log", "html"); final File file = new File(absoluteFolderPath + File.separator + fileName); FileUtils.write(file, html, StandardCharsets.UTF_8); return araConfiguration.getFileHttpAccess() + subFolder + "/" + fileName; } catch (IOException e) { log.error("HTTP log saving failed: {}", e.getMessage(), e); return null; } }  }
FileAssetService implements AssetService { @Override public String saveHttpLogs(String html) { try { final String subFolder = araConfiguration.getFileHttpLogsSubFolder(); final String absoluteFolderPath = araConfiguration.getFileHomeFolder() + subFolder; final String fileName = fileNameService.generateReportFileName("http-log", "html"); final File file = new File(absoluteFolderPath + File.separator + fileName); FileUtils.write(file, html, StandardCharsets.UTF_8); return araConfiguration.getFileHttpAccess() + subFolder + "/" + fileName; } catch (IOException e) { log.error("HTTP log saving failed: {}", e.getMessage(), e); return null; } }  @Override String saveScreenshot(byte[] screenshot, String scenarioName); @Override String saveHttpLogs(String html); }
FileAssetService implements AssetService { @Override public String saveHttpLogs(String html) { try { final String subFolder = araConfiguration.getFileHttpLogsSubFolder(); final String absoluteFolderPath = araConfiguration.getFileHomeFolder() + subFolder; final String fileName = fileNameService.generateReportFileName("http-log", "html"); final File file = new File(absoluteFolderPath + File.separator + fileName); FileUtils.write(file, html, StandardCharsets.UTF_8); return araConfiguration.getFileHttpAccess() + subFolder + "/" + fileName; } catch (IOException e) { log.error("HTTP log saving failed: {}", e.getMessage(), e); return null; } }  @Override String saveScreenshot(byte[] screenshot, String scenarioName); @Override String saveHttpLogs(String html);  }