summaryrefslogtreecommitdiff
path: root/src/test/java/com/keuin/kbackupfabric/backup/incremental/identifier
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/keuin/kbackupfabric/backup/incremental/identifier')
-rw-r--r--src/test/java/com/keuin/kbackupfabric/backup/incremental/identifier/SingleHashIdentifierTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/java/com/keuin/kbackupfabric/backup/incremental/identifier/SingleHashIdentifierTest.java b/src/test/java/com/keuin/kbackupfabric/backup/incremental/identifier/SingleHashIdentifierTest.java
new file mode 100644
index 0000000..4e15095
--- /dev/null
+++ b/src/test/java/com/keuin/kbackupfabric/backup/incremental/identifier/SingleHashIdentifierTest.java
@@ -0,0 +1,35 @@
+package com.keuin.kbackupfabric.backup.incremental.identifier;
+
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.junit.Assert.*;
+
+public class SingleHashIdentifierTest {
+
+ @Test
+ public void testEquals() {
+ SingleHashIdentifier id1 = new ConcreteSingleHashIdentifier(new byte[]{1, 2, 3, 4}, "ahash");
+ SingleHashIdentifier id2 = new ConcreteSingleHashIdentifier(new byte[]{1, 2, 3, 4}, "ahash");
+ SingleHashIdentifier id3 = new ConcreteSingleHashIdentifier(new byte[]{1, 2, 3}, "ahash");
+ SingleHashIdentifier id4 = new ConcreteSingleHashIdentifier(new byte[]{1, 2, 3, 4}, "a");
+ assertEquals(id1, id1);
+ assertEquals(id1, id2);
+ assertNotEquals(id1, id3);
+ assertNotEquals(id1, id4);
+ assertNotEquals(id3, id4);
+ }
+
+ private static class ConcreteSingleHashIdentifier extends SingleHashIdentifier {
+ protected ConcreteSingleHashIdentifier(byte[] hash, String type) {
+ super(hash, type);
+ }
+
+ @Override
+ protected byte[] hash(File file) throws IOException {
+ return new byte[0];
+ }
+ }
+} \ No newline at end of file