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.Assert.assertFalse;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertTrue;
13 import static org.mockito.Mockito.mock;
15 import com.google.common.collect.ImmutableList;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
19 public class AbstractRegistrationTreeTest extends AbstractRegistrationTree<Object> {
22 public void basicTest() throws Exception {
23 final PathArgument pathArgument = mock(PathArgument.class);
24 final RegistrationTreeNode<Object> registrationTreeNodeParent = new RegistrationTreeNode<>(null, pathArgument);
25 final RegistrationTreeNode<Object> registrationTreeNode =
26 new RegistrationTreeNode<>(registrationTreeNodeParent, pathArgument);
28 final Object registration = new Object();
30 this.addRegistration(registrationTreeNode, registration);
31 assertTrue(registrationTreeNode.getRegistrations().contains(registration));
34 this.removeRegistration(registrationTreeNode, registration);
35 assertFalse(registrationTreeNode.getRegistrations().contains(registration));
37 assertNotNull(this.findNodeFor(ImmutableList.of(pathArgument)));
38 assertNotNull(this.takeSnapshot());
41 @Test(expected = IllegalMonitorStateException.class)
42 public void unlockTest() throws Exception {