- private static void testTypedef(final String model) throws Exception {
- try {
- StmtTestUtils.parseYangSource("/bugs/YT838/" + model);
- fail("Expected failure due to type identifier shadowing");
- } catch (ReactorException e) {
- final Throwable cause = e.getCause();
- assertTrue(cause instanceof SourceException);
- assertTrue(cause.getMessage().startsWith(
- "Duplicate name for typedef (typedef?revision=2017-12-20)foo [at "));
- }
+ private static void testTypedef(final String model) {
+ final ReactorException ex = assertThrows(ReactorException.class,
+ () -> StmtTestUtils.parseYangSource("/bugs/YT838/" + model));
+ final Throwable cause = ex.getCause();
+ assertTrue(cause instanceof SourceException);
+ assertThat(cause, instanceOf(SourceException.class));
+ assertThat(cause.getMessage(), startsWith("Duplicate name for typedef (typedef?revision=2017-12-20)foo [at "));