Adopt odlparent-10.0.0/yangtools-8.0.0-SNAPSHOT
[mdsal.git] / dom / mdsal-dom-spi / src / test / java / org / opendaylight / mdsal / dom / spi / store / SnapshotBackedTransactionsTest.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.spi.store;
9
10 import static org.junit.Assert.assertNotNull;
11 import static org.mockito.Mockito.doReturn;
12 import static org.mockito.Mockito.mock;
13
14 import org.junit.Test;
15 import org.opendaylight.mdsal.dom.spi.store.SnapshotBackedWriteTransaction.TransactionReadyPrototype;
16 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification;
17 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeSnapshot;
18
19 public class SnapshotBackedTransactionsTest {
20     @Test
21     public void basicTest() throws Exception {
22         final DataTreeSnapshot dataTreeSnapshot = mock(DataTreeSnapshot.class);
23         final DataTreeModification dataTreeModification = mock(DataTreeModification.class);
24         final TransactionReadyPrototype<Object> transactionReadyPrototype =  mock(TransactionReadyPrototype.class);
25         doReturn(dataTreeModification).when(dataTreeSnapshot).newModification();
26
27         assertNotNull(SnapshotBackedTransactions.newReadTransaction(new Object(), false, dataTreeSnapshot));
28         assertNotNull(SnapshotBackedTransactions.newWriteTransaction(
29                 new Object(), false, dataTreeSnapshot, transactionReadyPrototype));
30         assertNotNull(SnapshotBackedTransactions.newReadWriteTransaction(
31                 new Object(), false, dataTreeSnapshot, transactionReadyPrototype));
32     }
33 }