From fa37a5e907d0d167ef139b536b12c745b9189eb8 Mon Sep 17 00:00:00 2001 From: Keuin Date: Tue, 2 Mar 2021 13:32:03 +0800 Subject: fix bad test --- .../backup/incremental/ObjectCollectionFactoryTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionFactoryTest.java b/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionFactoryTest.java index e686e30..4548c65 100644 --- a/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionFactoryTest.java +++ b/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionFactoryTest.java @@ -65,11 +65,23 @@ public class ObjectCollectionFactoryTest { } public void fromDirectory(int threads, int multiThreadThreshold) { + + final String testRoot = "./testfile/ObjectCollectionFactoryTest"; + File[] paths = new File[]{ + new File(testRoot + "/1/12"), + new File(testRoot + "/2"), + new File(testRoot + "/3") + }; + for (File f : paths) { + assertTrue("Failed to create directory: " + f.getAbsolutePath(), + f.isDirectory() || f.mkdirs()); + } + try { ObjectCollectionFactory factory = new ObjectCollectionFactory<>(Sha256Identifier.getFactory(), threads, multiThreadThreshold); ObjectCollection2 collection = - factory.fromDirectory(new File("./testfile/ObjectCollectionFactoryTest")); + factory.fromDirectory(new File(testRoot)); assertEquals("ObjectCollectionFactoryTest", collection.getName()); assertEquals(3, collection.getSubCollectionMap().size()); -- cgit v1.2.3