2 * Copyright (c) 2016 Cisco Systems, Inc. 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.stmt;
10 import static org.junit.jupiter.api.Assertions.assertEquals;
12 import org.junit.jupiter.api.Test;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.common.Revision;
16 class Bug7440Test extends AbstractYangTest {
18 void testRestrictedTypeParentSchemaPathInDeviate() {
19 final var schemaContext = assertEffectiveModelDir("/bugs/bug7440");
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();
25 final var deviations = foo.getDeviations();
26 assertEquals(1, deviations.size());
27 final var deviation = deviations.iterator().next();
29 final var deviates = deviation.getDeviates();
30 assertEquals(1, deviates.size());
31 final var deviateReplace = deviates.iterator().next();
33 final var deviatedType = deviateReplace.getDeviatedType();
34 assertEquals(QName.create(bar.getQNameModule(), "uint32"), deviatedType.getQName());