Rename DOMDataTreeChangeService
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / test / java / org / opendaylight / mdsal / binding / dom / adapter / LazyDOMRpcResultFutureTest.java
index 7a6a49a795cdbb5fd58087eefb005b52f4750755..63af518365281ea5c4236762ad488ce483ed65d9 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.mdsal.binding.dom.adapter;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
@@ -25,20 +25,20 @@ import java.lang.reflect.Field;
 import java.util.concurrent.TimeUnit;
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
+import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
+import org.opendaylight.yangtools.yang.binding.RpcOutput;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
 public class LazyDOMRpcResultFutureTest {
 
     private LazyDOMRpcResultFuture lazyDOMRpcResultFuture;
-    private final BindingNormalizedNodeCodecRegistry codec = mock(BindingNormalizedNodeCodecRegistry.class);
-    private final ListenableFuture future = mock(ListenableFuture.class);
-    private final RpcResult domRpcResult = mock(RpcResult.class);
+    private final BindingNormalizedNodeSerializer codec = mock(BindingNormalizedNodeSerializer.class);
+    private final ListenableFuture<RpcResult<?>> future = mock(ListenableFuture.class);
+    private final RpcResult<?> domRpcResult = mock(RpcResult.class);
 
     @Before
     public void setUp() throws Exception {
-        lazyDOMRpcResultFuture = (LazyDOMRpcResultFuture) LazyDOMRpcResultFuture.create(codec, future);
+        lazyDOMRpcResultFuture = LazyDOMRpcResultFuture.create(codec, future);
         reset(future);
         doReturn(true).when(future).cancel(anyBoolean());
         doNothing().when(future).addListener(any(), any());
@@ -48,7 +48,7 @@ public class LazyDOMRpcResultFutureTest {
         doReturn(true).when(future).isCancelled();
         doReturn(true).when(future).isDone();
 
-        doReturn(mock(DataContainer.class)).when(domRpcResult).getResult();
+        doReturn(mock(RpcOutput.class)).when(domRpcResult).getResult();
         doReturn(domRpcResult).when(future).get();
         doReturn(domRpcResult).when(future).get(1, TimeUnit.SECONDS);
     }
@@ -65,11 +65,11 @@ public class LazyDOMRpcResultFutureTest {
         verify(future).addListener(any(), any());
 
         assertTrue(lazyDOMRpcResultFuture.isCancelled() && lazyDOMRpcResultFuture.isDone());
-        assertEquals(lazyDOMRpcResultFuture.checkedGet(), lazyDOMRpcResultFuture.get(1, TimeUnit.SECONDS));
+        assertEquals(lazyDOMRpcResultFuture.get(), lazyDOMRpcResultFuture.get(1, TimeUnit.SECONDS));
         final Field result = LazyDOMRpcResultFuture.class.getDeclaredField("result");
         result.setAccessible(true);
         result.set(lazyDOMRpcResultFuture, null);
-        assertEquals(lazyDOMRpcResultFuture.checkedGet(1, TimeUnit.SECONDS), lazyDOMRpcResultFuture.get());
+        assertEquals(lazyDOMRpcResultFuture.get(1, TimeUnit.SECONDS), lazyDOMRpcResultFuture.get());
 
         result.set(lazyDOMRpcResultFuture, null);
         doReturn(new Object()).when(domRpcResult).getResult();
@@ -81,25 +81,25 @@ public class LazyDOMRpcResultFutureTest {
         assertNotNull(lazyDOMRpcResultFuture.get());
     }
 
-    @SuppressWarnings({"checkstyle:IllegalThrows","checkstyle:IllegalCatch"})
+    @SuppressWarnings({"checkstyle:IllegalThrows", "checkstyle:IllegalCatch", "checkstyle:avoidHidingCauseException"})
     @Test(expected = InterruptedException.class)
     public void checkedGetWithException() throws Throwable {
         doThrow(InterruptedException.class).when(future).get();
         try {
-            lazyDOMRpcResultFuture.checkedGet();
+            lazyDOMRpcResultFuture.get();
         } catch (RuntimeException e) {
             throw e.getCause();
         }
     }
 
-    @SuppressWarnings({"checkstyle:IllegalThrows","checkstyle:IllegalCatch"})
+    @SuppressWarnings({"checkstyle:IllegalThrows", "checkstyle:IllegalCatch", "checkstyle:avoidHidingCauseException"})
     @Test(expected = InterruptedException.class)
     public void checkedGetWithException2() throws Throwable {
         doThrow(InterruptedException.class).when(future).get(1, TimeUnit.SECONDS);
         try {
-            lazyDOMRpcResultFuture.checkedGet(1, TimeUnit.SECONDS);
+            lazyDOMRpcResultFuture.get(1, TimeUnit.SECONDS);
         } catch (RuntimeException e) {
             throw e.getCause();
         }
     }
-}
\ No newline at end of file
+}