44f171566a3c0dab8951acdc76354bd3e7a1c6cd
[mdsal.git] / dom / mdsal-dom-spi / src / test / java / org / opendaylight / mdsal / dom / spi / ForwardingDOMRpcProviderServiceTest.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 java.util.Collections;
16 import org.junit.Test;
17 import org.mockito.Mock;
18 import org.opendaylight.mdsal.dom.api.DOMRpcImplementation;
19 import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
20
21 public class ForwardingDOMRpcProviderServiceTest extends ForwardingDOMRpcProviderService {
22
23     @Mock(name = "domRpcProviderService")
24     private DOMRpcProviderService domRpcProviderService;
25
26     @Test
27     public void basicTest() throws Exception {
28         initMocks(this);
29
30         final DOMRpcImplementation domRpcImplementation = mock(DOMRpcImplementation.class);
31
32         doReturn(null).when(domRpcProviderService).registerRpcImplementation(domRpcImplementation);
33         this.registerRpcImplementation(domRpcImplementation);
34         verify(domRpcProviderService).registerRpcImplementation(domRpcImplementation);
35
36         doReturn(null).when(domRpcProviderService).registerRpcImplementation(domRpcImplementation,
37                 Collections.emptySet());
38         this.registerRpcImplementation(domRpcImplementation, Collections.emptySet());
39         verify(domRpcProviderService).registerRpcImplementation(domRpcImplementation, Collections.emptySet());
40     }
41
42     @Override
43     protected DOMRpcProviderService delegate() {
44         return domRpcProviderService;
45     }
46 }