summaryrefslogtreecommitdiff
path: root/src/test/java/com/keuin/kbackupfabric/backup/incremental
diff options
context:
space:
mode:
authorKeuin <[email protected]>2023-01-13 03:10:48 +0800
committerKeuin <[email protected]>2023-01-13 03:10:48 +0800
commit97e028f605d1aa060e4a4640a3dd683e51eaef3a (patch)
tree8b69515fcabfe5fae503dc09987c5c3d9866836a /src/test/java/com/keuin/kbackupfabric/backup/incremental
parentd7b2dd139f7e17d149a50a2ee777d28dac64b9eb (diff)
Move temporary files to standard path in IncBackupBackwardCompatibilityTest.
Diffstat (limited to 'src/test/java/com/keuin/kbackupfabric/backup/incremental')
-rw-r--r--src/test/java/com/keuin/kbackupfabric/backup/incremental/serializer/IncBakupBackwardCompatibilityTest.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/test/java/com/keuin/kbackupfabric/backup/incremental/serializer/IncBakupBackwardCompatibilityTest.java b/src/test/java/com/keuin/kbackupfabric/backup/incremental/serializer/IncBakupBackwardCompatibilityTest.java
index 3de75b9..fc72e9a 100644
--- a/src/test/java/com/keuin/kbackupfabric/backup/incremental/serializer/IncBakupBackwardCompatibilityTest.java
+++ b/src/test/java/com/keuin/kbackupfabric/backup/incremental/serializer/IncBakupBackwardCompatibilityTest.java
@@ -1,10 +1,14 @@
package com.keuin.kbackupfabric.backup.incremental.serializer;
+import com.keuin.kbackupfabric.TestUtils;
import com.keuin.kbackupfabric.backup.incremental.ObjectCollection2;
import com.keuin.kbackupfabric.backup.incremental.ObjectCollectionFactory;
import com.keuin.kbackupfabric.backup.incremental.ObjectCollectionSerializer;
import com.keuin.kbackupfabric.backup.incremental.identifier.Sha256Identifier;
import com.keuin.kbackupfabric.backup.name.IncrementalBackupFileNameEncoder;
+import org.apache.commons.io.FileUtils;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
import java.io.File;
@@ -21,8 +25,19 @@ public class IncBakupBackwardCompatibilityTest {
private final String customName = "test_backup";
private final LocalDateTime backupTime = LocalDateTime.of(2000, 1, 1, 1, 1, 1, 1);
- private final Path testRoot = Paths.get(".\\testfile\\IncBackupBackwardCompatibilityTest");
- private final File indexFile = new File(testRoot.toString(), IncrementalBackupFileNameEncoder.INSTANCE.encode(customName, backupTime));
+ private Path testRoot;
+ private File indexFile;
+
+ @Before
+ public void setUp() throws IOException {
+ testRoot = Paths.get(TestUtils.getTempDirectory("IncBackupBackwardCompatibilityTest"));
+ indexFile = new File(testRoot.toString(), IncrementalBackupFileNameEncoder.INSTANCE.encode(customName, backupTime));
+ }
+
+ @After
+ public void tearDown() throws IOException {
+ FileUtils.deleteDirectory(new File(testRoot.toString()));
+ }
@Test
public void testBackwardCompatibility() throws IOException {