Bug 5947: Increasing code coverage - mdsal-dom-spi
[mdsal.git] / dom / mdsal-dom-spi / src / test / java / org / opendaylight / mdsal / dom / spi / ForwardingDOMRpcServiceTest.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;
9
10 import static org.mockito.Mockito.doReturn;
11 import static org.mockito.Mockito.mock;
12 import static org.mockito.Mockito.verify;
13 import static org.mockito.MockitoAnnotations.initMocks;
14
15 import javax.annotation.Nonnull;
16 import org.junit.Test;
17 import org.mockito.Mock;
18 import org.opendaylight.mdsal.dom.api.DOMRpcAvailabilityListener;
19 import org.opendaylight.mdsal.dom.api.DOMRpcService;
20 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
21
22 public class ForwardingDOMRpcServiceTest extends ForwardingDOMRpcService {
23
24     @Mock(name = "domRpcService")
25     private DOMRpcService domRpcService;
26
27     @Test
28     public void basicTest() throws Exception {
29         initMocks(this);
30
31         final DOMRpcAvailabilityListener domRpcAvailabilityListener = mock(DOMRpcAvailabilityListener.class);
32
33         doReturn(null).when(domRpcService).invokeRpc(SchemaPath.SAME, null);
34         this.invokeRpc(SchemaPath.SAME, null);
35         verify(domRpcService).invokeRpc(SchemaPath.SAME, null);
36
37         doReturn(null).when(domRpcService).registerRpcListener(domRpcAvailabilityListener);
38         this.registerRpcListener(domRpcAvailabilityListener);
39         verify(domRpcService).registerRpcListener(domRpcAvailabilityListener);
40     }
41
42     @Nonnull
43     @Override
44     protected DOMRpcService delegate() {
45         return domRpcService;
46     }
47 }