*/
package org.opendaylight.yangtools.yang.data.tree.impl;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
-import java.util.Optional;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.opendaylight.yangtools.yang.common.ErrorSeverity;
import org.opendaylight.yangtools.yang.common.ErrorTag;
import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.YangNetconfError;
import org.opendaylight.yangtools.yang.data.api.YangNetconfErrorAware;
import org.opendaylight.yangtools.yang.data.api.schema.DistinctNodeContainer;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.spi.node.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.tree.api.DataTree;
-import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidate;
import org.opendaylight.yangtools.yang.data.tree.api.DataTreeConfiguration;
-import org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.tree.api.DataTreeSnapshot;
import org.opendaylight.yangtools.yang.data.tree.api.DataValidationFailedException;
import org.opendaylight.yangtools.yang.data.tree.impl.di.InMemoryDataTreeFactory;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
-public class ListConstraintsValidation {
+class ListConstraintsValidation {
private static final QName MASTER_CONTAINER_QNAME = QName.create(
"urn:opendaylight:params:xml:ns:yang:list-constraints-validation-test-model", "2015-02-02",
"master-container");
private DataTree inMemoryDataTree;
- @BeforeClass
- public static void beforeClass() {
- schemaContext = YangParserTestUtils.parseYangResource("/list-constraints-validation-test-model.yang");
+ @BeforeAll
+ static void beforeClass() {
+ schemaContext = YangParserTestUtils.parseYang("""
+ module list-constraints-validation-test-model {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:list-constraints-validation-test-model";
+ prefix "list-constraints-validation";
+
+ revision "2015-02-02" {
+ description "Initial revision.";
+ }
+
+ container master-container {
+ list min-max-list {
+ min-elements 2;
+ max-elements 3;
+ key "min-max-key-leaf";
+ leaf min-max-key-leaf {
+ type string;
+ }
+ }
+
+ list unbounded-list {
+ key "unbounded-key-leaf";
+ leaf unbounded-key-leaf {
+ type int8;
+ }
+ }
+
+ leaf-list min-max-leaf-list {
+ min-elements 1;
+ max-elements 3;
+ type string;
+ }
+
+ leaf-list unbounded-leaf-list {
+ type string;
+ }
+
+ list unkeyed-list {
+ max-elements 1;
+ leaf unkeyed-leaf {
+ type string;
+ }
+ }
+ }
+ }""");
}
- @AfterClass
- public static void afterClass() {
+ @AfterAll
+ static void afterClass() {
schemaContext = null;
}
- @Before
- public void prepare() throws DataValidationFailedException {
+ @BeforeEach
+ void prepare() throws DataValidationFailedException {
inMemoryDataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL,
schemaContext);
- final DataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
- final DataTreeModification modificationTree = initialDataTreeSnapshot.newModification();
+ final var initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
+ final var modificationTree = initialDataTreeSnapshot.newModification();
- modificationTree.write(MASTER_CONTAINER_PATH, ImmutableNodes.containerNode(MASTER_CONTAINER_QNAME));
+ modificationTree.write(MASTER_CONTAINER_PATH, ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(MASTER_CONTAINER_QNAME))
+ .build());
modificationTree.ready();
inMemoryDataTree.commit(inMemoryDataTree.prepare(modificationTree));
}
@Test
- public void minMaxListTestPass() throws DataValidationFailedException {
+ void minMaxListTestPass() throws DataValidationFailedException {
- final MapEntryNode fooEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "foo");
- final MapEntryNode barEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "bar");
- final MapNode mapNode1 = ImmutableNodes.mapNodeBuilder()
+ final var fooEntryNode = minMaxEntry("foo");
+ final var barEntryNode = minMaxEntry("bar");
+ final var mapNode1 = ImmutableNodes.newSystemMapBuilder()
.withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
.withChild(fooEntryNode).build();
- final MapNode mapNode2 = ImmutableNodes.mapNodeBuilder()
+ final var mapNode2 = ImmutableNodes.newSystemMapBuilder()
.withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
.withChild(barEntryNode).build();
- final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
+ final var modificationTree = inMemoryDataTree.takeSnapshot().newModification();
modificationTree.write(MIN_MAX_LIST_PATH, mapNode1);
modificationTree.merge(MIN_MAX_LIST_PATH, mapNode2);
modificationTree.ready();
inMemoryDataTree.validate(modificationTree);
- final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
+ final var prepare = inMemoryDataTree.prepare(modificationTree);
inMemoryDataTree.commit(prepare);
- final DataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
- final Optional<NormalizedNode> minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
+ final var snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
+ final var minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
assertTrue(minMaxListRead.isPresent());
- assertEquals(2, ((NormalizedNodeContainer<?>) minMaxListRead.get()).size());
+ assertEquals(2, ((NormalizedNodeContainer<?>) minMaxListRead.orElseThrow()).size());
}
- @Test(expected = DataValidationFailedException.class)
- public void minMaxListFail() throws DataValidationFailedException {
- DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
+ private static MapEntryNode minMaxEntry(final String value) {
+ return ImmutableNodes.newMapEntryBuilder()
+ .withNodeIdentifier(NodeIdentifierWithPredicates.of(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, value))
+ .withChild(ImmutableNodes.leafNode(MIN_MAX_KEY_LEAF_QNAME, value))
+ .build();
+ }
- final MapEntryNode fooEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "foo");
- final MapEntryNode barEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "bar");
- final MapEntryNode gooEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "goo");
- final MapNode mapNode = ImmutableNodes.mapNodeBuilder()
+ @Test
+ void minMaxListFail() {
+ assertThrows(DataValidationFailedException.class, () -> {
+ var modificationTree = inMemoryDataTree.takeSnapshot().newModification();
+
+ final var fooEntryNode = minMaxEntry("foo");
+ final var barEntryNode = minMaxEntry("bar");
+ final var gooEntryNode = minMaxEntry("goo");
+ final var mapNode = ImmutableNodes.newSystemMapBuilder()
.withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
- .withChild(fooEntryNode).build();
+ .withChild(fooEntryNode)
+ .build();
- final YangInstanceIdentifier fooPath = MIN_MAX_LIST_PATH.node(fooEntryNode.getIdentifier());
- final YangInstanceIdentifier barPath = MIN_MAX_LIST_PATH.node(barEntryNode.getIdentifier());
- final YangInstanceIdentifier gooPath = MIN_MAX_LIST_PATH.node(gooEntryNode.getIdentifier());
+ final var fooPath = MIN_MAX_LIST_PATH.node(fooEntryNode.name());
+ final var barPath = MIN_MAX_LIST_PATH.node(barEntryNode.name());
+ final var gooPath = MIN_MAX_LIST_PATH.node(gooEntryNode.name());
- modificationTree.write(MIN_MAX_LIST_PATH, mapNode);
- modificationTree.merge(barPath, barEntryNode);
- modificationTree.write(gooPath, gooEntryNode);
- modificationTree.delete(gooPath);
- modificationTree.ready();
+ modificationTree.write(MIN_MAX_LIST_PATH, mapNode);
+ modificationTree.merge(barPath, barEntryNode);
+ modificationTree.write(gooPath, gooEntryNode);
+ modificationTree.delete(gooPath);
+ modificationTree.ready();
- inMemoryDataTree.validate(modificationTree);
- DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree);
- inMemoryDataTree.commit(prepare1);
+ inMemoryDataTree.validate(modificationTree);
+ var prepare1 = inMemoryDataTree.prepare(modificationTree);
+ inMemoryDataTree.commit(prepare1);
- DataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
- Optional<NormalizedNode> minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
- assertTrue(minMaxListRead.isPresent());
- assertEquals(2, ((NormalizedNodeContainer<?>) minMaxListRead.get()).size());
+ var snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
+ var minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
+ assertTrue(minMaxListRead.isPresent());
+ assertEquals(2, ((NormalizedNodeContainer<?>) minMaxListRead.orElseThrow()).size());
- modificationTree = inMemoryDataTree.takeSnapshot().newModification();
- modificationTree.write(gooPath, gooEntryNode);
- modificationTree.ready();
+ modificationTree = inMemoryDataTree.takeSnapshot().newModification();
+ modificationTree.write(gooPath, gooEntryNode);
+ modificationTree.ready();
- inMemoryDataTree.validate(modificationTree);
- prepare1 = inMemoryDataTree.prepare(modificationTree);
- inMemoryDataTree.commit(prepare1);
+ inMemoryDataTree.validate(modificationTree);
+ prepare1 = inMemoryDataTree.prepare(modificationTree);
+ inMemoryDataTree.commit(prepare1);
- snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
- minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
- assertTrue(minMaxListRead.isPresent());
- assertEquals(3, ((NormalizedNodeContainer<?>) minMaxListRead.get()).size());
+ snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
+ minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
+ assertTrue(minMaxListRead.isPresent());
+ assertEquals(3, ((NormalizedNodeContainer<?>) minMaxListRead.orElseThrow()).size());
- modificationTree = inMemoryDataTree.takeSnapshot().newModification();
+ modificationTree = inMemoryDataTree.takeSnapshot().newModification();
- modificationTree.delete(gooPath);
- modificationTree.delete(fooPath);
- modificationTree.ready();
+ modificationTree.delete(gooPath);
+ modificationTree.delete(fooPath);
+ modificationTree.ready();
- inMemoryDataTree.validate(modificationTree);
+ inMemoryDataTree.validate(modificationTree);
+ });
}
@Test
- public void minMaxLeafListPass() throws DataValidationFailedException {
- final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
+ void minMaxLeafListPass() throws DataValidationFailedException {
+ final var modificationTree = inMemoryDataTree.takeSnapshot().newModification();
- final NodeWithValue<Object> barPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "bar");
- final NodeWithValue<Object> gooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "goo");
+ final var barPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "bar");
+ final var gooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "goo");
- modificationTree.write(MIN_MAX_LEAF_LIST_PATH, Builders.leafSetBuilder()
+ modificationTree.write(MIN_MAX_LEAF_LIST_PATH, ImmutableNodes.newSystemLeafSetBuilder()
.withNodeIdentifier(new NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME))
.withChildValue("foo")
.build());
- modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(barPath), Builders.leafSetEntryBuilder()
- .withNodeIdentifier(barPath)
- .withValue("bar")
- .build());
- modificationTree.merge(MIN_MAX_LEAF_LIST_PATH.node(gooPath), Builders.leafSetEntryBuilder()
- .withNodeIdentifier(gooPath)
- .withValue("goo")
- .build());
+ modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(barPath), ImmutableNodes.leafSetEntry(barPath));
+ modificationTree.merge(MIN_MAX_LEAF_LIST_PATH.node(gooPath), ImmutableNodes.leafSetEntry(gooPath));
modificationTree.delete(MIN_MAX_LEAF_LIST_PATH.node(gooPath));
modificationTree.ready();
inMemoryDataTree.validate(modificationTree);
- final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree);
+ final var prepare1 = inMemoryDataTree.prepare(modificationTree);
inMemoryDataTree.commit(prepare1);
- final DataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
- final Optional<NormalizedNode> masterContainer = snapshotAfterCommit.readNode(MASTER_CONTAINER_PATH);
+ final var snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
+ final var masterContainer = snapshotAfterCommit.readNode(MASTER_CONTAINER_PATH);
assertTrue(masterContainer.isPresent());
- final NormalizedNodeContainer<?> leafList =
- (NormalizedNodeContainer<?>) ((DistinctNodeContainer) masterContainer.get())
+ final var leafList =
+ (NormalizedNodeContainer<?>) ((DistinctNodeContainer) masterContainer.orElseThrow())
.childByArg(new NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME));
assertNotNull(leafList);
assertEquals(2, leafList.size());
}
@Test
- public void minMaxLeafListFail() {
- final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
+ void minMaxLeafListFail() {
+ final var modificationTree = inMemoryDataTree.takeSnapshot().newModification();
- final NodeWithValue<Object> barPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "bar");
- final NodeWithValue<Object> gooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "goo");
- final NodeWithValue<Object> fuuPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "fuu");
+ final var barPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "bar");
+ final var gooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "goo");
+ final var fuuPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "fuu");
- modificationTree.write(MIN_MAX_LEAF_LIST_PATH, Builders.leafSetBuilder()
+ modificationTree.write(MIN_MAX_LEAF_LIST_PATH, ImmutableNodes.newSystemLeafSetBuilder()
.withNodeIdentifier(new NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME))
.withChildValue("foo")
.build());
- modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(barPath), Builders.leafSetEntryBuilder()
- .withNodeIdentifier(barPath)
- .withValue("bar")
- .build());
- modificationTree.merge(MIN_MAX_LEAF_LIST_PATH.node(gooPath), Builders.leafSetEntryBuilder()
- .withNodeIdentifier(gooPath)
- .withValue("goo")
- .build());
- modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(fuuPath), Builders.leafSetEntryBuilder()
- .withNodeIdentifier(fuuPath)
- .withValue("fuu")
- .build());
+ modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(barPath), ImmutableNodes.leafSetEntry(barPath));
+ modificationTree.merge(MIN_MAX_LEAF_LIST_PATH.node(gooPath), ImmutableNodes.leafSetEntry(gooPath));
+ modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(fuuPath), ImmutableNodes.leafSetEntry(fuuPath));
- final MinMaxElementsValidationFailedException ex = assertThrows(MinMaxElementsValidationFailedException.class,
+ final var ex = assertThrows(MinMaxElementsValidationFailedException.class,
() -> modificationTree.ready());
assertEquals("(urn:opendaylight:params:xml:ns:yang:list-constraints-validation-test-model?"
+ "revision=2015-02-02)min-max-leaf-list has too many elements (4), can have at most 3",
}
@Test
- public void unkeyedListTestPass() throws DataValidationFailedException {
- final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
+ void unkeyedListTestPass() throws DataValidationFailedException {
+ final var modificationTree = inMemoryDataTree.takeSnapshot().newModification();
- final UnkeyedListNode unkeyedListNode = Builders.unkeyedListBuilder()
+ final var unkeyedListNode = ImmutableNodes.newUnkeyedListBuilder()
.withNodeIdentifier(new NodeIdentifier(UNKEYED_LIST_QNAME))
- .withValue(List.of(Builders.unkeyedListEntryBuilder()
+ .withValue(List.of(ImmutableNodes.newUnkeyedListEntryBuilder()
.withNodeIdentifier(new NodeIdentifier(UNKEYED_LEAF_QNAME))
.withChild(ImmutableNodes.leafNode(UNKEYED_LEAF_QNAME, "foo"))
.build()))
.build();
- modificationTree.write(MASTER_CONTAINER_PATH, ImmutableNodes.containerNode(MASTER_CONTAINER_QNAME));
+ modificationTree.write(MASTER_CONTAINER_PATH, ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(MASTER_CONTAINER_QNAME))
+ .build());
modificationTree.merge(UNKEYED_LIST_PATH, unkeyedListNode);
modificationTree.ready();
inMemoryDataTree.validate(modificationTree);
- final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree);
+ final var prepare1 = inMemoryDataTree.prepare(modificationTree);
inMemoryDataTree.commit(prepare1);
- final DataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
- final Optional<NormalizedNode> unkeyedListRead = snapshotAfterCommit.readNode(UNKEYED_LIST_PATH);
+ final var snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
+ final var unkeyedListRead = snapshotAfterCommit.readNode(UNKEYED_LIST_PATH);
assertTrue(unkeyedListRead.isPresent());
- assertEquals(1, ((UnkeyedListNode) unkeyedListRead.get()).size());
+ assertEquals(1, ((UnkeyedListNode) unkeyedListRead.orElseThrow()).size());
}
@Test
- public void unkeyedListTestFail() {
- final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
+ void unkeyedListTestFail() {
+ final var modificationTree = inMemoryDataTree.takeSnapshot().newModification();
- modificationTree.write(UNKEYED_LIST_PATH, Builders.unkeyedListBuilder()
+ modificationTree.write(UNKEYED_LIST_PATH, ImmutableNodes.newUnkeyedListBuilder()
.withNodeIdentifier(new NodeIdentifier(UNKEYED_LIST_QNAME))
.withValue(List.of(
- Builders.unkeyedListEntryBuilder()
+ ImmutableNodes.newUnkeyedListEntryBuilder()
.withNodeIdentifier(new NodeIdentifier(UNKEYED_LEAF_QNAME))
.withChild(ImmutableNodes.leafNode(UNKEYED_LEAF_QNAME, "foo"))
.build(),
- Builders.unkeyedListEntryBuilder()
+ ImmutableNodes.newUnkeyedListEntryBuilder()
.withNodeIdentifier(new NodeIdentifier(UNKEYED_LEAF_QNAME))
.withChild(ImmutableNodes.leafNode(UNKEYED_LEAF_QNAME, "bar"))
.build()))
.build());
- final MinMaxElementsValidationFailedException ex = assertThrows(MinMaxElementsValidationFailedException.class,
+ final var ex = assertThrows(MinMaxElementsValidationFailedException.class,
() -> modificationTree.ready());
assertEquals("(urn:opendaylight:params:xml:ns:yang:list-constraints-validation-test-model?"
+ "revision=2015-02-02)unkeyed-list has too many elements (2), can have at most 1", ex.getMessage());
}
private static void assertOperationFailed(final Exception ex, final String expectedAppTag) {
- assertThat(ex, instanceOf(YangNetconfErrorAware.class));
- final List<YangNetconfError> errors = ((YangNetconfErrorAware) ex).getNetconfErrors();
+ assertInstanceOf(YangNetconfErrorAware.class, ex);
+ final var errors = ((YangNetconfErrorAware) ex).getNetconfErrors();
assertEquals(1, errors.size());
- final YangNetconfError error = errors.get(0);
+ final var error = errors.get(0);
assertEquals(ErrorSeverity.ERROR, error.severity());
assertEquals(ErrorType.APPLICATION, error.type());
assertEquals(ErrorTag.OPERATION_FAILED, error.tag());