2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.hamcrest.CoreMatchers.instanceOf;
11 import static org.hamcrest.CoreMatchers.startsWith;
12 import static org.hamcrest.MatcherAssert.assertThat;
13 import static org.junit.Assert.assertThrows;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
17 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
19 public class YT1189Test {
21 public void testDescendantAugment() {
22 final ReactorException ex = assertThrows(ReactorException.class,
23 () -> StmtTestUtils.parseYangSource("/bugs/YT1189/foo.yang"));
24 final Throwable cause = ex.getCause();
25 assertThat(cause, instanceOf(SourceException.class));
26 assertThat(cause.getMessage(),
27 startsWith("Descendant schema node identifier is not allowed when used outside of a uses statement [at "));
31 public void testAbsoluteUsesAugment() {
32 final ReactorException ex = assertThrows(ReactorException.class,
33 () -> StmtTestUtils.parseYangSource("/bugs/YT1189/bar.yang"));
34 final Throwable cause = ex.getCause();
35 assertThat(cause, instanceOf(SourceException.class));
36 assertThat(cause.getMessage(),
37 startsWith("Absolute schema node identifier is not allowed when used within a uses statement [at "));