Remove unused spying 69/101169/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 4 Apr 2022 14:59:45 +0000 (16:59 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 16 May 2022 16:27:01 +0000 (18:27 +0200)
KeepaliveSalFacadeTest has a bit of useless mocking/spying. This is
failing with JDK17. While we would want to mock the behavior exactly
without delays, use real executor for now.

Change-Id: I462852fb8ed56ed5370d7036bc2c3c862129dce1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4111fc386b35e327d1038b7b7b8a52d6457df28d)

netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacadeTest.java

index 5a426df4b087e349dc08259ad6c7be681b6d5790..c748c6d7a8556081b83e6a306b2f2dddb4cd16d2 100644 (file)
@@ -20,13 +20,11 @@ import static org.mockito.Mockito.verify;
 import java.net.InetSocketAddress;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.Mockito;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
 import org.opendaylight.mdsal.dom.api.DOMRpcService;
@@ -61,9 +59,6 @@ public class KeepaliveSalFacadeTest {
 
     private DOMRpcService proxyRpc;
 
-    @Mock
-    private ScheduledFuture<?> currentKeepalive;
-
     private KeepaliveSalFacade keepaliveSalFacade;
 
     @Before
@@ -73,14 +68,6 @@ public class KeepaliveSalFacadeTest {
         doNothing().when(listener).disconnect();
         doNothing().when(underlyingSalFacade).onDeviceConnected(isNull(), isNull(), any(DOMRpcService.class), isNull());
 
-        ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
-        executorServiceSpy = Mockito.spy(executorService);
-
-        doAnswer(invocationOnMock -> {
-            invocationOnMock.callRealMethod();
-            return currentKeepalive;
-        }).when(executorServiceSpy).schedule(Mockito.<Runnable>any(), Mockito.anyLong(), any());
-
         keepaliveSalFacade =
                 new KeepaliveSalFacade(REMOTE_DEVICE_ID, underlyingSalFacade, executorServiceSpy, 1L, 1L);
         keepaliveSalFacade.setListener(listener);