Migrate yang-data-codec-gson to JUnit5
[yangtools.git] / codec / yang-data-codec-gson / src / test / java / org / opendaylight / yangtools / yang / data / codec / gson / YT1029Test.java
index 5e4cb8390ca68ad8205e7d958144fdc89e3c64e3..41739570b002dfe2aa8488b074b31a8f87f2dae2 100644 (file)
@@ -7,37 +7,35 @@
  */
 package org.opendaylight.yangtools.yang.data.codec.gson;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import java.io.IOException;
 import java.io.StringWriter;
-import java.io.Writer;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
 
-public class YT1029Test extends AbstractComplexJsonTest {
+class YT1029Test extends AbstractComplexJsonTest {
     @Test
-    public void testMultipleRootChildren() throws IOException {
-        final Writer writer = new StringWriter();
-        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.createExclusiveWriter(
+    void testMultipleRootChildren() throws Exception {
+        final var writer = new StringWriter();
+        final var jsonStream = JSONNormalizedNodeStreamWriter.createExclusiveWriter(
             lhotkaCodecFactory, JsonWriterFactory.createJsonWriter(writer, 2));
-        try (NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream)) {
+        try (var nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream)) {
             nodeWriter.write(CONT1_WITH_EMPTYLEAF);
             nodeWriter.write(CONT1_WITH_EMPTYLEAF);
         }
 
-        assertEquals("{\n"
-                + "  \"complexjson:cont1\": {\n"
-                + "    \"empty\": [\n"
-                + "      null\n"
-                + "    ]\n"
-                + "  },\n"
-                + "  \"complexjson:cont1\": {\n"
-                + "    \"empty\": [\n"
-                + "      null\n"
-                + "    ]\n"
-                + "  }\n"
-                + "}", writer.toString());
+        assertEquals("""
+            {
+              "complexjson:cont1": {
+                "empty": [
+                  null
+                ]
+              },
+              "complexjson:cont1": {
+                "empty": [
+                  null
+                ]
+              }
+            }""", writer.toString());
     }
 }