2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.codec.gson;
10 import static org.junit.Assert.assertEquals;
12 import java.io.IOException;
13 import java.io.StringWriter;
14 import java.io.Writer;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
17 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
18 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
20 public class YT1029Test extends AbstractComplexJsonTest {
22 public void testMultipleRootChildren() throws IOException {
23 final Writer writer = new StringWriter();
24 final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.createExclusiveWriter(
25 lhotkaCodecFactory, SchemaPath.ROOT, null, JsonWriterFactory.createJsonWriter(writer, 2));
26 try (NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream)) {
27 nodeWriter.write(CONT1_WITH_EMPTYLEAF);
28 nodeWriter.write(CONT1_WITH_EMPTYLEAF);
32 + " \"complexjson:cont1\": {\n"
37 + " \"complexjson:cont1\": {\n"
42 + "}", writer.toString());