Rename package in binding-codegen
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug7440Test.java
1 /*
2  * Copyright (c) 2016 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.yangtools.yang.stmt;
9
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11
12 import org.junit.jupiter.api.Test;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.common.Revision;
15
16 class Bug7440Test extends AbstractYangTest {
17     @Test
18     void testRestrictedTypeParentSchemaPathInDeviate() {
19         final var schemaContext = assertEffectiveModelDir("/bugs/bug7440");
20
21         final var revision = Revision.of("2016-12-23");
22         final var foo = schemaContext.findModule("foo", revision).orElseThrow();
23         final var bar = schemaContext.findModule("bar", revision).orElseThrow();
24
25         final var deviations = foo.getDeviations();
26         assertEquals(1, deviations.size());
27         final var deviation = deviations.iterator().next();
28
29         final var deviates = deviation.getDeviates();
30         assertEquals(1, deviates.size());
31         final var deviateReplace = deviates.iterator().next();
32
33         final var deviatedType = deviateReplace.getDeviatedType();
34         assertEquals(QName.create(bar.getQNameModule(), "uint32"), deviatedType.getQName());
35     }
36 }