5543b3f25177ce7f0a4451b57d8120f8c469ebb2
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug4410Test.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.Assert.assertTrue;
11 import static org.junit.Assert.fail;
12
13 import com.google.common.base.Throwables;
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
17
18 public class Bug4410Test {
19
20     @Test
21     public void test() throws Exception {
22         try {
23             StmtTestUtils.parseYangSources("/bugs/bug4410");
24             fail("SomeModifiersUnresolvedException should be thrown.");
25         } catch (SomeModifiersUnresolvedException e) {
26             Throwable rootCause = Throwables.getRootCause(e);
27             assertTrue(rootCause instanceof InferenceException);
28             final String message = rootCause.getMessage();
29             assertTrue(message.startsWith("Type [(foo)"));
30             assertTrue(message.contains("was not found"));
31         }
32     }
33 }