diff options
author | Keuin <[email protected]> | 2021-02-15 17:52:53 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2021-02-15 17:52:53 +0800 |
commit | 6d6f0b486ac42b6bd69ddb8862ee3af7b819f3a7 (patch) | |
tree | ce01c3a18b7e90af6204ff0db90a606eade81778 /src/test/java/com/keuin/kbackupfabric/backup/incremental/identifier | |
parent | 68b102c763b0d0b21fb71575f1238d3cc879f959 (diff) |
Add tests.
Implementing auto backup and configuration (not finished)
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.java | 35 |
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 |