Convert mdsal-dom-spi to a JPMS module
[mdsal.git] / dom / mdsal-dom-spi / src / test / java / org / opendaylight / mdsal / dom / spi / ForwardingDOMNotificationServiceTest.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
14 import java.util.Collections;
15 import org.junit.Test;
16 import org.junit.runner.RunWith;
17 import org.mockito.Mock;
18 import org.mockito.junit.MockitoJUnitRunner;
19 import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
20 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
21
22 @RunWith(MockitoJUnitRunner.StrictStubs.class)
23 public class ForwardingDOMNotificationServiceTest extends ForwardingDOMNotificationService {
24     @Mock(name = "domNotificationService")
25     public DOMNotificationService domNotificationService;
26
27     @Test
28     public void basicTest() throws Exception {
29         final DOMNotificationListener domNotificationListener = mock(DOMNotificationListener.class);
30
31         doReturn(null).when(domNotificationService).registerNotificationListener(domNotificationListener);
32         this.registerNotificationListener(domNotificationListener);
33         verify(domNotificationService).registerNotificationListener(domNotificationListener);
34
35         doReturn(null).when(domNotificationService).registerNotificationListener(domNotificationListener,
36                 Collections.emptySet());
37         this.registerNotificationListener(domNotificationListener, Collections.emptySet());
38         verify(domNotificationService).registerNotificationListener(domNotificationListener, Collections.emptySet());
39     }
40
41     @Override
42     protected DOMNotificationService delegate() {
43         return domNotificationService;
44     }
45 }