package org.opendaylight.yangtools.yang.stmt;
import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
import org.junit.Test;
-import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-public class Bug8831Test {
+public class Bug8831Test extends AbstractYangTest {
@Test
public void test() throws Exception {
- assertNotNull(TestUtils.loadModules("/bugs/bug8831/valid"));
+ assertEffectiveModelDir("/bugs/bug8831/valid");
}
@Test
public void invalidModelsTest() {
- final var ex = assertThrows(SomeModifiersUnresolvedException.class,
- () -> TestUtils.parseYangSource("/bugs/bug8831/invalid/inv-model.yang"));
- final var cause = ex.getCause();
- assertThat(cause, instanceOf(SourceException.class));
- assertThat(cause.getMessage(), containsString("has default value 'any' marked with an if-feature statement"));
+ assertSourceException(containsString("has default value 'any' marked with an if-feature statement"),
+ "/bugs/bug8831/invalid/inv-model.yang");
}
@Test
public void invalidModelsTest2() {
- final var ex = assertThrows(SomeModifiersUnresolvedException.class,
- () -> TestUtils.parseYangSource("/bugs/bug8831/invalid/inv-model2.yang"));
- final var cause = ex.getCause();
- assertThat(cause, instanceOf(SourceException.class));
- assertThat(cause.getMessage(), containsString("has default value 'any' marked with an if-feature statement"));
+ assertSourceException(containsString("has default value 'any' marked with an if-feature statement"),
+ "/bugs/bug8831/invalid/inv-model2.yang");
}
}