Skip to content

Commit

Permalink
Added log message for missing playback jsons. (#6070)
Browse files Browse the repository at this point in the history
* Added log message for missing playback jsons.
  • Loading branch information
sima-zhu authored Nov 1, 2019
1 parent c675b1d commit 750ab29
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,19 @@ private void writeDataToFile() throws IOException {
private File getRecordFile(String testName) {
URL folderUrl = InterceptorManager.class.getClassLoader().getResource(".");
File folderFile = new File(folderUrl.getPath() + RECORD_FOLDER);

if (!folderFile.exists()) {
if (folderFile.mkdir()) {
logger.verbose("Created directory: {}", folderFile.getPath());
}
}

String filePath = folderFile.getPath() + "/" + testName + ".json";
logger.info("==> Playback file path: " + filePath);

return new File(filePath);
File playbackFile = new File(folderFile, testName + ".json");
if (!playbackFile.exists()) {
throw logger.logExceptionAsError(new RuntimeException(String.format(
"Missing playback file. File path: %s. ", playbackFile)));
}
logger.info("==> Playback file path: " + playbackFile);
return playbackFile;
}

/**
Expand Down

0 comments on commit 750ab29

Please sign in to comment.