Add Empty.value()
[yangtools.git] / codec / yang-data-codec-gson / src / test / java / org / opendaylight / yangtools / yang / data / codec / gson / AbstractComplexJsonTest.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.data.codec.gson;
9
10 import org.junit.AfterClass;
11 import org.junit.BeforeClass;
12 import org.opendaylight.yangtools.yang.common.Empty;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
16 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
17 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
18 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
19 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
20
21 public abstract class AbstractComplexJsonTest {
22     static final QName CONT_1 = QName.create("ns:complex:json", "2014-08-11", "cont1");
23     private static final QName EMPTY_LEAF = QName.create(CONT_1, "empty");
24
25     static final ContainerNode CONT1_WITH_EMPTYLEAF = Builders.containerBuilder()
26             .withNodeIdentifier(new NodeIdentifier(CONT_1))
27             .addChild(ImmutableNodes.leafNode(EMPTY_LEAF, Empty.value()))
28             .build();
29
30     static EffectiveModelContext schemaContext;
31     static JSONCodecFactory lhotkaCodecFactory;
32
33     @BeforeClass
34     public static void beforeClass() {
35         schemaContext = YangParserTestUtils.parseYangResourceDirectory("/complexjson/yang");
36         lhotkaCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.getShared(schemaContext);
37     }
38
39     @AfterClass
40     public static void afterClass() {
41         lhotkaCodecFactory = null;
42         schemaContext = null;
43     }
44 }