- // FIXME: use a utility for this loading
- final StatementStreamSource yangFile1 = sourceForResource(
- "/yang-grammar-test/stmtsep-in-statements.yang");
- final StatementStreamSource yangFile2 = sourceForResource(
- "/yang-grammar-test/stmtsep-in-statements2.yang");
- final StatementStreamSource yangFile3 = sourceForResource(
- "/yang-grammar-test/stmtsep-in-statements-sub.yang");
-
- final BuildAction reactor = RFC7950Reactors.defaultReactor().newBuild()
- .addSources(yangFile1, yangFile2, yangFile3);
- // TODO: change test or create new module in order to respect new statement parser validations
- try {
- final SchemaContext result = reactor.buildEffective();
- } catch (final ReactorException e) {
- assertEquals(SomeModifiersUnresolvedException.class, e.getClass());
- assertTrue(e.getCause() instanceof SourceException);
- assertTrue(e.getCause().getMessage().startsWith("aaa is not a YANG statement or use of extension"));
- }
+ final var ex = assertThrows(SomeModifiersUnresolvedException.class,
+ () -> TestUtils.parseYangSource(
+ "/yang-grammar-test/stmtsep-in-statements.yang",
+ "/yang-grammar-test/stmtsep-in-statements2.yang",
+ "/yang-grammar-test/stmtsep-in-statements-sub.yang"));
+ final var cause = ex.getCause();
+ assertThat(cause, instanceOf(SourceException.class));
+ assertThat(cause.getMessage(), startsWith("aaa is not a YANG statement or use of extension"));