From c7aa2b6a54064157dc167002c850cd403c3b1656 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 23 Jan 2022 18:10:03 +0100 Subject: Document repository layout, add modified Base64 ByteString encoding. Change-Id: I564db0e346346b608fa11527590e264c694fedaf --- .../eu/mulk/jgvariant/ostree/ByteStringTest.java | 70 ++++++++++++++++++++++ .../mulk/jgvariant/ostree/OstreeDecoderTest.java | 6 -- 2 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 jgvariant-ostree/src/test/java/eu/mulk/jgvariant/ostree/ByteStringTest.java (limited to 'jgvariant-ostree/src/test/java/eu') 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; @@ -37,11 +36,6 @@ class OstreeDecoderTest { @GivenBinaryResource("/ostree/deltas/Mc/iDXVydLGaHpQCRyFFC0bLYU_9Bap+4G07jB1RRDVI/0") byte[] deltaPartPayloadBytes; - @Test - void testTrivial() { - assertTrue(true); - } - @Test void testSummaryDecoder() { var decoder = Summary.decoder(); -- cgit v1.2.3