Clean up binding-model stuff a bit
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug7146Test.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.hamcrest.CoreMatchers.containsString;
11 import static org.hamcrest.MatcherAssert.assertThat;
12 import static org.junit.Assert.assertThrows;
13 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
14 import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource;
15
16 import org.junit.jupiter.api.Test;
17 import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException;
18
19 class Bug7146Test {
20     @Test
21     void shouldFailOnSyntaxError() {
22         final var cause = assertThrows(IllegalArgumentException.class,
23             () -> StmtTestUtils.parseYangSources(sourceForResource("/bugs/bug7146/foo.yang"))).getCause();
24         assertInstanceOf(YangSyntaxErrorException.class, cause);
25         assertThat(cause.getMessage(), containsString("extraneous input '#'"));
26     }
27 }