From 270dd70a0fa80fbea0f7985a551c1b453e3f9903 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 22 Jan 2021 20:08:29 +0800 Subject: Fix a potential bug caused by the wrong implementation of compareTo method in ObjectElement --- .../ObjectCollectionSerializerTest.java | 32 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionSerializerTest.java') diff --git a/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionSerializerTest.java b/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionSerializerTest.java index 33f5a9c..d21e5b3 100644 --- a/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionSerializerTest.java +++ b/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionSerializerTest.java @@ -13,27 +13,47 @@ public class ObjectCollectionSerializerTest { @Test public void testSerializationConsistency1() throws IOException { - testSerializationConsistency(1); + testSerializationConsistency(1, 0); } @Test public void testSerializationConsistency2() throws IOException { - testSerializationConsistency(2); + testSerializationConsistency(2, 0); } @Test public void testSerializationConsistency4() throws IOException { - testSerializationConsistency(4); + testSerializationConsistency(4, 0); } @Test public void testSerializationConsistency8() throws IOException { - testSerializationConsistency(8); + testSerializationConsistency(8, 0); } - public void testSerializationConsistency(int threads) throws IOException { + @Test + public void testSerializationConsistency1A() throws IOException { + testSerializationConsistency(1, 1000); + } + + @Test + public void testSerializationConsistency2A() throws IOException { + testSerializationConsistency(2, 1000); + } + + @Test + public void testSerializationConsistency4A() throws IOException { + testSerializationConsistency(4, 1000); + } + + @Test + public void testSerializationConsistency8A() throws IOException { + testSerializationConsistency(8, 1000); + } + + public void testSerializationConsistency(int threads, int multiThreadThreshold) throws IOException { ObjectCollectionFactory factory = - new ObjectCollectionFactory<>(Sha256Identifier.getFactory(), threads); + new ObjectCollectionFactory<>(Sha256Identifier.getFactory(), threads, multiThreadThreshold); ObjectCollection collection = factory.fromDirectory(new File("./testfile/ObjectCollectionFactoryTest")); File file = new File("./testfile/serialized"); -- cgit v1.2.3