1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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];
}
}
}
|