checkStyleViolationSeverity=error implemented for mdsal-dom-inmemory-datastore
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / test / java / org / opendaylight / mdsal / dom / store / inmemory / WritableInteriorNodeTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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.mdsal.dom.store.inmemory;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.mockito.Mockito.doNothing;
12 import static org.mockito.Mockito.verify;
13 import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.DOM_DATA_TREE_WRITE_CURSOR;
14 import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.NODE_IDENTIFIER;
15 import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.WRITEABLE_MODIFICATION_NODE;
16 import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.resetMocks;
17
18 import java.util.HashMap;
19 import java.util.Map;
20 import org.junit.After;
21 import org.junit.Test;
22 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
23
24 public class WritableInteriorNodeTest {
25
26     @Test
27     public void basicTest() throws Exception {
28         doNothing().when(WRITEABLE_MODIFICATION_NODE).markDeleted();
29         doNothing().when(DOM_DATA_TREE_WRITE_CURSOR).exit();
30
31         final Map<PathArgument, WriteableModificationNode> children = new HashMap<>();
32         children.put(NODE_IDENTIFIER, WRITEABLE_MODIFICATION_NODE);
33
34         final WritableInteriorNode writableInteriorNode = new WritableInteriorNode(NODE_IDENTIFIER, children);
35         assertEquals(writableInteriorNode.getIdentifier(), NODE_IDENTIFIER);
36
37         writableInteriorNode.createOperation(DOM_DATA_TREE_WRITE_CURSOR).exit();
38         verify(DOM_DATA_TREE_WRITE_CURSOR).exit();
39     }
40
41     @After
42     public void reset() {
43         resetMocks();
44     }
45 }