Reduce list/map/entry strategy confusion
[yangtools.git] / yang / yang-data-impl / src / test / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / MapEntryRootTest.java
1 /*
2  * Copyright (c) 2019 Pantheon Technologies, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
9
10 import static org.hamcrest.CoreMatchers.instanceOf;
11 import static org.hamcrest.MatcherAssert.assertThat;
12 import static org.junit.Assert.assertTrue;
13
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
16 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
17 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration;
18 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
19
20 public class MapEntryRootTest extends AbstractTestModelTest {
21
22     @Test
23     public void testMapEntryRoot() {
24         final DataTreeConfiguration treeConfig = DataTreeConfiguration.builder(TreeType.OPERATIONAL).setRootPath(
25             TestModel.TEST_PATH.node(TestModel.OUTER_LIST_QNAME).node(
26                 NodeIdentifierWithPredicates.of(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, (short) 12))).build();
27         final DataTree dataTree = new InMemoryDataTreeFactory().create(treeConfig, SCHEMA_CONTEXT);
28         assertTrue(dataTree instanceof InMemoryDataTree);
29
30         final InMemoryDataTree imdt = (InMemoryDataTree) dataTree;
31         final InMemoryDataTreeModification mod = imdt.takeSnapshot().newModification();
32         final ModificationApplyOperation strategy = mod.getStrategy();
33         assertThat(strategy, instanceOf(MapEntryModificationStrategy.class));
34     }
35 }