Skip to content

Commit

Permalink
fixup! test: Migrate ORSGraphRepoManagerTest to use temp folders
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelsJP committed Oct 20, 2023
1 parent 18eada9 commit 894170b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Date;
Expand Down Expand Up @@ -207,7 +208,7 @@ void shouldDownloadGraph(GraphInfo remoteGraphInfo, GraphInfo localGraphInfo, Fi
assertEquals(expected, orsGraphRepoManager.shouldDownloadGraph(remoteGraphInfo, localGraphInfo, persistedDownloadFile, persistedRemoteGraphInfo));
}

public static Stream<Arguments> shouldDownloadGraphMethodSource() {
public static Stream<Arguments> shouldDownloadGraphMethodSource() throws IOException {
ORSGraphInfoV1 earlierOrsGraphInfoV1 = new ORSGraphInfoV1(new Date(EARLIER_DATE));
ORSGraphInfoV1 middleOrsGraphInfoV1 = new ORSGraphInfoV1(new Date(MIDDLE_DATE));
ORSGraphInfoV1 laterOrsGraphInfoV1 = new ORSGraphInfoV1(new Date(LATER_DATE));
Expand All @@ -216,9 +217,10 @@ public static Stream<Arguments> shouldDownloadGraphMethodSource() {
GraphInfo existingGraphInfoMiddle = new GraphInfo().withPersistedInfo(middleOrsGraphInfoV1);
GraphInfo existingGraphInfoLater = new GraphInfo().withPersistedInfo(laterOrsGraphInfoV1);

File resourcesDir = TEMP_DIR.toFile().getParentFile();
File nonexistingFile = new File(resourcesDir, "missing.ghz");
File existingFile = new File(resourcesDir, "some.ghz");
Path resourcesDir = Files.createTempDirectory(TEMP_DIR, "ghz");

File nonexistingFile = new File(resourcesDir.toAbsolutePath().toFile(), "missing.ghz");
File existingFile = Files.createTempFile(resourcesDir, "some", ".ghz").toFile();

return Stream.of(
Arguments.of(existingGraphInfoMiddle, existingGraphInfoEarlier, existingFile, earlierOrsGraphInfoV1, true),
Expand Down

0 comments on commit 894170b

Please sign in to comment.