Skip to content

Commit

Permalink
Update test files 2
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddieppois committed May 13, 2024
1 parent f234eaa commit 2fb61d5
Showing 1 changed file with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,29 @@ public void setUp() throws Exception {
IOUtils.resourceDirectories = new ArrayList<String>();
IOUtils.clearDevicePaths();
System.setOut(new PrintStream(this.console));
File dir = new File("target" + separator + "refreshIG");
if (dir.exists()) {
FileUtils.deleteDirectory(dir);
}

// Delete directories
deleteDirectory("target" + File.separator + "refreshIG");
deleteDirectory("target" + File.separator + "NewRefreshIG");

deleteTempINI();
}

/**
* Attempts to delete a directory if it exists.
* @param path The path to the directory to delete.
*/
private void deleteDirectory(String path) {
File dir = new File(path);
if (dir.exists()) {
try {
FileUtils.deleteDirectory(dir);
} catch (IOException e) {
System.err.println("Failed to delete directory: " + path + " - " + e.getMessage());
}
}
}

@Test
public void testNewRefreshOperation() throws IOException {
copyResourcesToTargetDir(TARGET_OUTPUT_FOLDER_PATH, "NewRefreshIG");
Expand Down Expand Up @@ -173,17 +188,17 @@ private boolean verifyRelatedArtifacts(JsonArray relatedArtifacts) {
return false;
}

@AfterSuite
public void cleanup() {
// Delete the generated files
File folder = new File(TARGET_OUTPUT_IG_LIBRARY_FOLDER_PATH);
for (String fileName : NEW_REFRESH_IG_LIBRARY_FILE_NAMES) {
File jsonFile = new File(folder, fileName);
if (jsonFile.exists()) {
jsonFile.delete();
}
}
}
// @AfterSuite
// public void cleanup() {
// // Delete the generated files
// File folder = new File(TARGET_OUTPUT_IG_LIBRARY_FOLDER_PATH);
// for (String fileName : NEW_REFRESH_IG_LIBRARY_FILE_NAMES) {
// File jsonFile = new File(folder, fileName);
// if (jsonFile.exists()) {
// jsonFile.delete();
// }
// }
// }

private void verifyFileContent(File file, String expectedContent) {
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
Expand Down

0 comments on commit 2fb61d5

Please sign in to comment.