From b8b95e918438299f04f76a2145820ea33b52cfa3 Mon Sep 17 00:00:00 2001 From: Rhys <98863820+rhysdh540@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:42:28 -0400 Subject: [PATCH] strengthen test and remove unnecessary BufferedReader creation --- src/main/java/dev/nolij/zson/Zson.java | 2 +- src/test/java/ZsonTest.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/nolij/zson/Zson.java b/src/main/java/dev/nolij/zson/Zson.java index 348c2a0..fc63940 100644 --- a/src/main/java/dev/nolij/zson/Zson.java +++ b/src/main/java/dev/nolij/zson/Zson.java @@ -341,7 +341,7 @@ public static T parseFile(@NotNull Path path) throws IOException { @Contract(pure = true) public static T parseString(@NotNull String serialized) { try { - return parse(new BufferedReader(new StringReader(serialized))); + return parse(new StringReader(serialized)); } catch (IOException e) { throw new IllegalArgumentException(e); } diff --git a/src/test/java/ZsonTest.java b/src/test/java/ZsonTest.java index 3148430..46bfa3d 100644 --- a/src/test/java/ZsonTest.java +++ b/src/test/java/ZsonTest.java @@ -173,7 +173,11 @@ public void testObject() { "testEnum": "ONE", }"""; - assertEquals(expected, new Zson().stringify(json)); + String actual = new Zson().stringify(json); + + assertEquals(expected, actual); + + json = Zson.parseString(actual); TestObject obj = Zson.map2Obj(json, TestObject.class); assertEquals(42, obj.wow);