diff --git a/src/test/java/ch/dissem/msgpack/ReaderTest.java b/src/test/java/ch/dissem/msgpack/ReaderTest.java index 6066bd0..d0b1bef 100644 --- a/src/test/java/ch/dissem/msgpack/ReaderTest.java +++ b/src/test/java/ch/dissem/msgpack/ReaderTest.java @@ -73,6 +73,7 @@ public class ReaderTest { MPType read = reader.read(new ByteArrayInputStream(out.toByteArray())); assertThat(read, instanceOf(MPArray.class)); assertThat((MPArray>) read, is(array)); + assertThat(read.toJson(), is("[\n AQMDBw==,\n false,\n 3.141592653589793,\n 1.5,\n 42,\n {\n },\n null,\n \"yay! 🤓\"\n]")); } @Test @@ -217,18 +218,18 @@ public class ReaderTest { } @SuppressWarnings("unchecked") - private void ensureMapIsEncodedAndDecodedCorrectly(int length) throws Exception { + private void ensureMapIsEncodedAndDecodedCorrectly(int size) throws Exception { MPNil nil = new MPNil(); - HashMap map = new HashMap<>(length); - for (int i = 0; i < length; i++) { - map.put(nil, nil); + HashMap map = new HashMap<>(size); + for (int i = 0; i < size; i++) { + map.put(mp(i), nil); } - MPMap value = new MPMap<>(map); + MPMap value = new MPMap<>(map); ByteArrayOutputStream out = new ByteArrayOutputStream(); value.pack(out); MPType read = reader.read(new ByteArrayInputStream(out.toByteArray())); assertThat(read, instanceOf(MPMap.class)); - assertThat((MPMap) read, is(value)); + assertThat((MPMap) read, is(value)); } private String stringWithLength(int length) {