5edaec2cc8559f669b8608ef7d61b7ce5dfcc1b4
[mdsal.git] / dom / mdsal-dom-spi / src / test / java / org / opendaylight / mdsal / dom / spi / store / ForwardingDOMStoreThreePhaseCommitCohortTest.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.mockito.Mockito.doReturn;
11 import static org.mockito.Mockito.verify;
12 import static org.mockito.MockitoAnnotations.initMocks;
13
14 import org.junit.Test;
15 import org.mockito.Mock;
16
17 public class ForwardingDOMStoreThreePhaseCommitCohortTest extends ForwardingDOMStoreThreePhaseCommitCohort {
18
19     @Mock(name = "domStoreThreePhaseCommitCohort")
20     private DOMStoreThreePhaseCommitCohort domStoreThreePhaseCommitCohort;
21
22     @Test
23     public void basicTest() throws Exception {
24         initMocks(this);
25
26         doReturn(null).when(domStoreThreePhaseCommitCohort).canCommit();
27         this.canCommit();
28         verify(domStoreThreePhaseCommitCohort).canCommit();
29
30         doReturn(null).when(domStoreThreePhaseCommitCohort).preCommit();
31         this.preCommit();
32         verify(domStoreThreePhaseCommitCohort).preCommit();
33
34         doReturn(null).when(domStoreThreePhaseCommitCohort).commit();
35         this.commit();
36         verify(domStoreThreePhaseCommitCohort).commit();
37
38         doReturn(null).when(domStoreThreePhaseCommitCohort).abort();
39         this.abort();
40         verify(domStoreThreePhaseCommitCohort).abort();
41     }
42
43     @Override
44     protected DOMStoreThreePhaseCommitCohort delegate() {
45         return domStoreThreePhaseCommitCohort;
46     }
47 }