1 |
|
package liquibase.change; |
2 |
|
|
3 |
|
import static org.junit.Assert.*; |
4 |
|
import org.junit.Test; |
5 |
|
|
6 |
|
import java.io.ByteArrayInputStream; |
7 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 4 |
Complexity Density: 0.24 |
|
8 |
|
public class CheckSumTest { |
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
9 |
1
|
@Test... |
10 |
|
public void testCompute_String() { |
11 |
1
|
String valueToHash = "asdf"; |
12 |
1
|
CheckSum checkSum = CheckSum.compute(valueToHash); |
13 |
1
|
assertEquals(CheckSum.getCurrentVersion(), checkSum.getVersion()); |
14 |
1
|
assertFalse(checkSum.toString().equals(valueToHash)); |
15 |
|
} |
16 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
17 |
1
|
@Test... |
18 |
|
public void testCompute_Stream() { |
19 |
1
|
String valueToHash = "asdf"; |
20 |
1
|
CheckSum checkSum = CheckSum.compute(new ByteArrayInputStream(valueToHash.getBytes())); |
21 |
1
|
assertEquals(CheckSum.getCurrentVersion(), checkSum.getVersion()); |
22 |
1
|
assertFalse(checkSum.toString().equals(valueToHash)); |
23 |
1
|
assertEquals(CheckSum.compute(valueToHash).toString(), checkSum.toString()); |
24 |
|
} |
25 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
26 |
1
|
@Test... |
27 |
|
public void parse_v2() { |
28 |
1
|
String checksumString = "2:asdf"; |
29 |
1
|
CheckSum checkSum = CheckSum.parse(checksumString); |
30 |
1
|
assertEquals(2, checkSum.getVersion()); |
31 |
1
|
assertEquals(checksumString, checksumString); |
32 |
|
} |
33 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
34 |
1
|
@Test... |
35 |
|
public void parse_v1() { |
36 |
1
|
String checksumString = "asdf"; |
37 |
1
|
CheckSum checkSum = CheckSum.parse(checksumString); |
38 |
1
|
assertEquals(1, checkSum.getVersion()); |
39 |
1
|
assertEquals("1:asdf", checkSum.toString()); |
40 |
|
} |
41 |
|
} |