8aef1b5a42eb46bb0ea549406d733d7942530705
[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 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.DOMNotificationListener;
19 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
20
21 public class ForwardingDOMNotificationServiceTest extends ForwardingDOMNotificationService {
22
23     @Mock(name = "domNotificationService")
24     private DOMNotificationService domNotificationService;
25
26     @Test
27     public void basicTest() throws Exception {
28         initMocks(this);
29
30         final DOMNotificationListener domNotificationListener = mock(DOMNotificationListener.class);
31
32         doReturn(null).when(domNotificationService).registerNotificationListener(domNotificationListener);
33         this.registerNotificationListener(domNotificationListener);
34         verify(domNotificationService).registerNotificationListener(domNotificationListener);
35
36         doReturn(null).when(domNotificationService).registerNotificationListener(domNotificationListener,
37                 Collections.emptySet());
38         this.registerNotificationListener(domNotificationListener, Collections.emptySet());
39         verify(domNotificationService).registerNotificationListener(domNotificationListener, Collections.emptySet());
40     }
41
42     @Override
43     protected DOMNotificationService delegate() {
44         return domNotificationService;
45     }
46 }