-
Notifications
You must be signed in to change notification settings - Fork 458
/
Copy pathComputeTransHashSHA2Test.java
57 lines (47 loc) · 1.96 KB
/
ComputeTransHashSHA2Test.java
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package net.authorize.sample.Sha512;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
public class ComputeTransHashSHA2Test {
@Rule public final ExpectedException thrown = ExpectedException.none();
@Test
public void getHMACSHA512InputNotNullNotNullOutputIllegalArgumentException() throws Exception {
thrown.expect(IllegalArgumentException.class);
ComputeTransHashSHA2.getHMACSHA512("/", "/");
}
@Test
public void getHMACSHA512InputNotNullNotNullOutputIllegalArgumentException2() throws Exception {
thrown.expect(IllegalArgumentException.class);
ComputeTransHashSHA2.getHMACSHA512(
"\u0003\u0001\u0001 \u0010\u0000 0 ",
"\u0000\u0000\u0000?????????????????????????????????????");
}
@Test
public void getHMACSHA512InputNotNullNullOutputIllegalArgumentException() throws Exception {
thrown.expect(IllegalArgumentException.class);
ComputeTransHashSHA2.getHMACSHA512(
"\u8003\u0001\u0000\u0000>\u0000\ubffe\ubffe\ubffe\u0003",
null);
}
@Test
public void getHMACSHA512InputNullNotNullOutputIllegalArgumentException() throws Exception {
thrown.expect(IllegalArgumentException.class);
ComputeTransHashSHA2.getHMACSHA512(
null, "\u0000\u0000\u0000??????????????????????");
}
@Test
public void hexStringToByteArrayInputNotNullOutput0() {
Assert.assertArrayEquals(new byte[] {}, ComputeTransHashSHA2.hexStringToByteArray(""));
}
@Test
public void hexStringToByteArrayInputNotNullOutputStringIndexOutOfBoundsException() {
thrown.expect(StringIndexOutOfBoundsException.class);
ComputeTransHashSHA2.hexStringToByteArray("/");
}
@Test
public void hexStringToByteArrayInputNotNullOutputStringIndexOutOfBoundsException2() {
thrown.expect(StringIndexOutOfBoundsException.class);
ComputeTransHashSHA2.hexStringToByteArray("#\uff77\u0002");
}
}