- public void shouldFailOnInvalidDeviateAdd3() throws Exception {
- try {
- StmtTestUtils.parseYangSources(
- sourceForResource("/deviation-resolution-test/deviation-add/foo-invalid-4.yang"),
- sourceForResource("/deviation-resolution-test/deviation-add/bar-invalid-4.yang"));
- fail("An exception should have been thrown.");
- } catch (final ReactorException ex) {
- final Throwable cause = ex.getCause();
- assertTrue(cause instanceof InferenceException);
- assertTrue(cause.getMessage().startsWith("Deviation cannot add substatement (urn:ietf:params:xml:ns:yang"
- + ":yin:1)default to target node (bar?revision=2017-02-01)my-used-leaf because it is already "
- + "defined in target and can appear only once."));
- }
+ public void shouldFailOnInvalidDeviateAdd3() {
+ final ReactorException ex = assertThrows(ReactorException.class, () -> StmtTestUtils.parseYangSources(
+ sourceForResource("/deviation-resolution-test/deviation-add/foo-invalid-4.yang"),
+ sourceForResource("/deviation-resolution-test/deviation-add/bar-invalid-4.yang")));
+ final Throwable cause = ex.getCause();
+ assertThat(cause, instanceOf(InferenceException.class));
+ assertThat(cause.getMessage(), startsWith("Deviation cannot add substatement (urn:ietf:params:xml:ns:yang"
+ + ":yin:1)default to target node (bar?revision=2017-02-01)my-used-leaf because it is already "
+ + "defined in target and can appear only once."));