65d64527108b98963fc30b80426a90abd7fc3114
[mdsal.git] / binding / mdsal-binding-dom-codec / src / test / java / org / opendaylight / mdsal / binding / dom / codec / impl / TopLevelContainerViaUsesTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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.mdsal.binding.dom.codec.impl;
9
10 import static org.junit.Assert.assertEquals;
11
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.test.top.via.uses.rev151112.container.top.ContainerTop;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
17
18 public class TopLevelContainerViaUsesTest extends AbstractBindingCodecTest {
19
20     private static final InstanceIdentifier<ContainerTop> TOP_LEVEL_CONTAINER_FROM_USES =
21             InstanceIdentifier.create(ContainerTop.class);
22
23     @Test
24     public void testBindingToDomFirst() {
25         final YangInstanceIdentifier yangII = codecContext.toYangInstanceIdentifier(TOP_LEVEL_CONTAINER_FROM_USES);
26         final PathArgument lastArg = yangII.getLastPathArgument();
27         assertEquals(ContainerTop.QNAME, lastArg.getNodeType());
28     }
29
30
31     @Test
32     public void testDomToBindingFirst() {
33         final YangInstanceIdentifier yangII = YangInstanceIdentifier.of(ContainerTop.QNAME);
34         InstanceIdentifier<?> bindingII = codecContext.fromYangInstanceIdentifier(yangII);
35         assertEquals(TOP_LEVEL_CONTAINER_FROM_USES, bindingII);
36     }
37
38 }