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
9 package org.opendaylight.yangtools.yang.stmt;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.Module;
17 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
19 public class Bug5712Test extends AbstractYangTest {
21 public void testTypedefWithNewStatementParser() {
22 final var badModule = assertEffectiveModelDir("/bugs/bug5712").findModules("bad").iterator().next();
23 assertNotNull(badModule);
24 checkThing2TypeDef(badModule);
27 private static void checkThing2TypeDef(final Module badModule) {
28 TypeDefinition<?> thing2 = null;
29 for (TypeDefinition<?> typeDef : badModule.getTypeDefinitions()) {
30 if (typeDef.getQName().getLocalName().equals("thing2")) {
36 assertNotNull(thing2);
37 TypeDefinition<?> baseType = thing2.getBaseType();
38 assertEquals(QName.create("urn:opendaylight:bad", "2016-04-11", "thing"), baseType.getQName());