aboutsummaryrefslogtreecommitdiff
path: root/jgvariant-ostree/src/test
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2022-01-23 18:10:03 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2022-01-23 18:10:03 +0100
commitc7aa2b6a54064157dc167002c850cd403c3b1656 (patch)
treeab255bf08d9666102d5ac58a6614d6abda711f8f /jgvariant-ostree/src/test
parente14bd1b88c708276d267d0e05c68a7714f7d5afc (diff)
Document repository layout, add modified Base64 ByteString encoding.
Change-Id: I564db0e346346b608fa11527590e264c694fedaf
Diffstat (limited to 'jgvariant-ostree/src/test')
-rw-r--r--jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/ByteStringTest.java70
-rw-r--r--jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/OstreeDecoderTest.java6
2 files changed, 70 insertions, 6 deletions
diff --git a/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/ByteStringTest.java b/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/ByteStringTest.java
new file mode 100644
index 0000000..a5fa2b4
--- /dev/null
+++ b/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/ByteStringTest.java
@@ -0,0 +1,70 @@
+package eu.mulk.jgvariant.ostree;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.Test;
+
+class ByteStringTest {
+
+ @Test
+ void testToModifiedBase64() {
+ assertEquals("MciDXVydLGaHpQCRyFFC0bLYU_9Bap+4G07jB1RRDVI", testByteString1.modifiedBase64());
+ }
+
+ @Test
+ void testOfModifiedBase64() {
+ assertEquals(
+ testByteString1,
+ ByteString.ofModifiedBase64("MciDXVydLGaHpQCRyFFC0bLYU_9Bap+4G07jB1RRDVI"));
+ }
+
+ @Test
+ void testToHex() {
+ assertEquals(
+ "31c8835d5c9d2c6687a50091c85142d1b2d853ff416a9fb81b4ee30754510d52", testByteString1.hex());
+ }
+
+ @Test
+ void testOfHex() {
+ assertEquals(
+ testByteString1,
+ ByteString.ofHex("31c8835d5c9d2c6687a50091c85142d1b2d853ff416a9fb81b4ee30754510d52"));
+ }
+
+ private static final ByteString testByteString1 =
+ new ByteString(
+ new byte[] {
+ (byte) 0x31,
+ (byte) 0xc8,
+ (byte) 0x83,
+ (byte) 0x5d,
+ (byte) 0x5c,
+ (byte) 0x9d,
+ (byte) 0x2c,
+ (byte) 0x66,
+ (byte) 0x87,
+ (byte) 0xa5,
+ (byte) 0x00,
+ (byte) 0x91,
+ (byte) 0xc8,
+ (byte) 0x51,
+ (byte) 0x42,
+ (byte) 0xd1,
+ (byte) 0xb2,
+ (byte) 0xd8,
+ (byte) 0x53,
+ (byte) 0xff,
+ (byte) 0x41,
+ (byte) 0x6a,
+ (byte) 0x9f,
+ (byte) 0xb8,
+ (byte) 0x1b,
+ (byte) 0x4e,
+ (byte) 0xe3,
+ (byte) 0x07,
+ (byte) 0x54,
+ (byte) 0x51,
+ (byte) 0x0d,
+ (byte) 0x52
+ });
+}
diff --git a/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/OstreeDecoderTest.java b/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/OstreeDecoderTest.java
index db222f9..031b1cd 100644
--- a/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/OstreeDecoderTest.java
+++ b/jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/OstreeDecoderTest.java
@@ -2,7 +2,6 @@ package eu.mulk.jgvariant.ostree;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import com.adelean.inject.resources.junit.jupiter.GivenBinaryResource;
import com.adelean.inject.resources.junit.jupiter.TestWithResources;
@@ -38,11 +37,6 @@ class OstreeDecoderTest {
byte[] deltaPartPayloadBytes;
@Test
- void testTrivial() {
- assertTrue(true);
- }
-
- @Test
void testSummaryDecoder() {
var decoder = Summary.decoder();
var summary = decoder.decode(ByteBuffer.wrap(summaryBytes));