Bump yangtools to 13.0.0
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / test / java / org / opendaylight / mdsal / binding / dom / adapter / BindingDOMMountPointListenerAdapterTest.java
index 3d9cd408d567a1d4467942a698ba07033963097c..70fb1385315e7206579df758b63940cc4b1b74d8 100644 (file)
@@ -7,65 +7,63 @@
  */
 package org.opendaylight.mdsal.binding.dom.adapter;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.MockitoAnnotations.initMocks;
+import static org.mockito.Mockito.verifyNoInteractions;
 
 import com.google.common.util.concurrent.MoreExecutors;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.mdsal.binding.api.MountPointService.MountPointListener;
 import org.opendaylight.mdsal.binding.dom.adapter.test.util.BindingBrokerTestFactory;
-import org.opendaylight.mdsal.binding.dom.adapter.test.util.BindingTestContext;
 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
+@RunWith(MockitoJUnitRunner.StrictStubs.class)
 public class BindingDOMMountPointListenerAdapterTest {
-
-    private BindingDOMMountPointListenerAdapter bindingDOMMountPointListenerAdapter;
-    private BindingToNormalizedNodeCodec codec;
+    private BindingDOMMountPointListenerAdapter adapter;
+    private AdapterContext codec;
 
     @Mock private MountPointListener listener;
     @Mock private DOMMountPointService mountPointService;
-    @Mock private ListenerRegistration listenerRegistration;
+    @Mock private ListenerRegistration<?> listenerRegistration;
 
     @Before
     public void setUp() throws Exception {
-        initMocks(this);
-        final BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory();
+        final var testFactory = new BindingBrokerTestFactory();
         testFactory.setExecutor(MoreExecutors.newDirectExecutorService());
-        final BindingTestContext testContext = testFactory.getTestContext();
+        final var testContext = testFactory.getTestContext();
         testContext.start();
         codec = testContext.getCodec();
         doReturn(listenerRegistration).when(mountPointService).registerProvisionListener(any());
-        bindingDOMMountPointListenerAdapter =
-                new BindingDOMMountPointListenerAdapter<>(listener, codec, mountPointService);
+        adapter = new BindingDOMMountPointListenerAdapter(listener, codec, mountPointService);
     }
 
     @Test
     public void basicTest() throws Exception {
-        assertEquals(listener, bindingDOMMountPointListenerAdapter.getInstance());
-        bindingDOMMountPointListenerAdapter.close();
+        assertSame(listener, adapter.listener);
+        adapter.close();
         verify(listenerRegistration).close();
     }
 
     @Test
     public void onMountPointCreatedWithExceptionTest() throws Exception {
         reset(listener);
-        bindingDOMMountPointListenerAdapter.onMountPointCreated(YangInstanceIdentifier.EMPTY);
-        verifyZeroInteractions(listener);
+        adapter.onMountPointCreated(YangInstanceIdentifier.of());
+        verifyNoInteractions(listener);
     }
 
     @Test
     public void onMountPointRemovedWithExceptionTest() throws Exception {
         reset(listener);
-        bindingDOMMountPointListenerAdapter.onMountPointRemoved(YangInstanceIdentifier.EMPTY);
-        verifyZeroInteractions(listener);
+        adapter.onMountPointRemoved(YangInstanceIdentifier.of());
+        verifyNoInteractions(listener);
     }
 }
\ No newline at end of file