blob: a5fa2b4f0741704de06000e612cb106c82df7955 [file] [log] [blame]
Matthias Andreas Benkardc7aa2b62022-01-23 18:10:03 +01001package eu.mulk.jgvariant.ostree;
2
3import static org.junit.jupiter.api.Assertions.assertEquals;
4
5import org.junit.jupiter.api.Test;
6
7class ByteStringTest {
8
9 @Test
10 void testToModifiedBase64() {
11 assertEquals("MciDXVydLGaHpQCRyFFC0bLYU_9Bap+4G07jB1RRDVI", testByteString1.modifiedBase64());
12 }
13
14 @Test
15 void testOfModifiedBase64() {
16 assertEquals(
17 testByteString1,
18 ByteString.ofModifiedBase64("MciDXVydLGaHpQCRyFFC0bLYU_9Bap+4G07jB1RRDVI"));
19 }
20
21 @Test
22 void testToHex() {
23 assertEquals(
24 "31c8835d5c9d2c6687a50091c85142d1b2d853ff416a9fb81b4ee30754510d52", testByteString1.hex());
25 }
26
27 @Test
28 void testOfHex() {
29 assertEquals(
30 testByteString1,
31 ByteString.ofHex("31c8835d5c9d2c6687a50091c85142d1b2d853ff416a9fb81b4ee30754510d52"));
32 }
33
34 private static final ByteString testByteString1 =
35 new ByteString(
36 new byte[] {
37 (byte) 0x31,
38 (byte) 0xc8,
39 (byte) 0x83,
40 (byte) 0x5d,
41 (byte) 0x5c,
42 (byte) 0x9d,
43 (byte) 0x2c,
44 (byte) 0x66,
45 (byte) 0x87,
46 (byte) 0xa5,
47 (byte) 0x00,
48 (byte) 0x91,
49 (byte) 0xc8,
50 (byte) 0x51,
51 (byte) 0x42,
52 (byte) 0xd1,
53 (byte) 0xb2,
54 (byte) 0xd8,
55 (byte) 0x53,
56 (byte) 0xff,
57 (byte) 0x41,
58 (byte) 0x6a,
59 (byte) 0x9f,
60 (byte) 0xb8,
61 (byte) 0x1b,
62 (byte) 0x4e,
63 (byte) 0xe3,
64 (byte) 0x07,
65 (byte) 0x54,
66 (byte) 0x51,
67 (byte) 0x0d,
68 (byte) 0x52
69 });
70}