aboutsummaryrefslogtreecommitdiff
path: root/jgvariant-core/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'jgvariant-core/src/test/java')
-rw-r--r--jgvariant-core/src/test/java/eu/mulk/jgvariant/core/DecoderTest.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/jgvariant-core/src/test/java/eu/mulk/jgvariant/core/DecoderTest.java b/jgvariant-core/src/test/java/eu/mulk/jgvariant/core/DecoderTest.java
index d72a1b6..ab7de44 100644
--- a/jgvariant-core/src/test/java/eu/mulk/jgvariant/core/DecoderTest.java
+++ b/jgvariant-core/src/test/java/eu/mulk/jgvariant/core/DecoderTest.java
@@ -11,6 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import java.nio.ByteBuffer;
import java.text.ParseException;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.junit.jupiter.api.Test;
@@ -271,7 +272,18 @@ class DecoderTest {
}
@Test
- void testDictionaryEntry() {
+ void testDictionaryEntryAsMapEntry() {
+ var data =
+ new byte[] {0x61, 0x20, 0x6B, 0x65, 0x79, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x06};
+
+ var decoder =
+ Decoder.ofDictionaryEntry(
+ Decoder.ofString(UTF_8), Decoder.ofInt().withByteOrder(LITTLE_ENDIAN));
+ assertEquals(Map.entry("a key", 514), decoder.decode(ByteBuffer.wrap(data)));
+ }
+
+ @Test
+ void testDictionaryEntryAsRecord() {
var data =
new byte[] {0x61, 0x20, 0x6B, 0x65, 0x79, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x06};