2 * Copyright (c) 2016 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.mdsal.dom.spi;
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11 import static org.junit.jupiter.api.Assertions.assertNotNull;
12 import static org.mockito.Mockito.doNothing;
14 import java.util.concurrent.locks.Lock;
15 import org.junit.jupiter.api.Test;
16 import org.junit.jupiter.api.extension.ExtendWith;
17 import org.mockito.Mock;
18 import org.mockito.junit.jupiter.MockitoExtension;
19 import org.opendaylight.mdsal.dom.spi.AbstractRegistrationTree.Node;
20 import org.opendaylight.yangtools.yang.common.QName;
21 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
23 @ExtendWith(MockitoExtension.class)
24 class RegistrationTreeSnapshotTest {
29 void basicTest() throws Exception {
30 final var pathArgument = new NodeIdentifier(QName.create("", "pathArgument"));
31 final var registrationTreeNode = new Node<>(null, pathArgument);
32 try (var registrationTreeSnapshot = new AbstractRegistrationTree.Snapshot<>(lock, registrationTreeNode)) {
33 assertNotNull(registrationTreeSnapshot.getRootNode());
34 assertEquals(registrationTreeNode, registrationTreeSnapshot.getRootNode());
35 doNothing().when(lock).unlock();