2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.tree.impl;
10 import static org.junit.jupiter.api.Assertions.assertThrows;
12 import org.junit.jupiter.api.BeforeEach;
13 import org.junit.jupiter.api.Test;
14 import org.opendaylight.yangtools.yang.data.tree.api.DataTree;
15 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeConfiguration;
16 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification;
17 import org.opendaylight.yangtools.yang.data.tree.api.DataValidationFailedException;
18 import org.opendaylight.yangtools.yang.data.tree.impl.di.InMemoryDataTreeFactory;
20 class DataTreeTransactionTest extends AbstractTestModelTest {
21 private DataTree tree;
25 tree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL, SCHEMA_CONTEXT);
29 void testSealedValidate() throws DataValidationFailedException {
30 final var mod = tree.takeSnapshot().newModification();
36 void testSealedPrepare() throws DataValidationFailedException {
37 final var mod = tree.takeSnapshot().newModification();
43 void testUnsealedValidate() throws DataValidationFailedException {
44 assertThrows(IllegalArgumentException.class, () -> {
45 final DataTreeModification mod = tree.takeSnapshot().newModification();
51 void testUnsealedPrepare() throws DataValidationFailedException {
52 assertThrows(IllegalArgumentException.class, () -> {
53 final DataTreeModification mod = tree.takeSnapshot().newModification();