2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.controller.cluster.databroker.actors.dds;
10 import static org.mockito.MockitoAnnotations.initMocks;
12 import java.util.function.Supplier;
13 import org.junit.Before;
14 import org.junit.Test;
15 import org.mockito.Mock;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
18 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModificationCursor;
20 public class FailedDataTreeModificationTest {
22 private FailedDataTreeModification failedDataTreeModification;
25 private YangInstanceIdentifier instanceIdentifier;
27 private NormalizedNode normalizedNode;
29 private DataTreeModificationCursor dataTreeModificationCursor;
32 public void setUp() throws Exception {
34 final Supplier supplier = () -> new RuntimeException("Operation failed.");
35 failedDataTreeModification = new FailedDataTreeModification(supplier);
38 @Test(expected = RuntimeException.class)
39 public void testReadNode() throws Exception {
40 failedDataTreeModification.readNode(instanceIdentifier);
43 @Test(expected = RuntimeException.class)
44 public void testNewModification() throws Exception {
45 failedDataTreeModification.newModification();
48 @Test(expected = RuntimeException.class)
49 public void testDelete() throws Exception {
50 failedDataTreeModification.delete(instanceIdentifier);
53 @Test(expected = RuntimeException.class)
54 public void testMerge() throws Exception {
55 failedDataTreeModification.merge(instanceIdentifier, normalizedNode);
58 @Test(expected = RuntimeException.class)
59 public void testWrite() throws Exception {
60 failedDataTreeModification.write(instanceIdentifier, normalizedNode);
63 @Test(expected = RuntimeException.class)
64 public void testReady() throws Exception {
65 failedDataTreeModification.ready();
68 @Test(expected = RuntimeException.class)
69 public void testApplyToCursor() throws Exception {
70 failedDataTreeModification.applyToCursor(dataTreeModificationCursor);
73 @Test(expected = RuntimeException.class)
74 public void testCreateCursor() throws Exception {
75 failedDataTreeModification.createCursor(instanceIdentifier);