X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fimpl%2Fmapping%2Foperations%2FDefaultCloseSessionTest.java;h=2566e070224e0fdffe987e1462cee71412e02227;hb=45cfee1861924b4a8086d38079ce8cbd320386d6;hp=068ebf6eb4a3a28edb2f9f35254cdd633ec3eb0d;hpb=e2f838d72117730ceaae4b4ac4992cc244678c71;p=netconf.git diff --git a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/mapping/operations/DefaultCloseSessionTest.java b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/mapping/operations/DefaultCloseSessionTest.java index 068ebf6eb4..2566e07022 100644 --- a/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/mapping/operations/DefaultCloseSessionTest.java +++ b/netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/mapping/operations/DefaultCloseSessionTest.java @@ -22,8 +22,6 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.EventLoop; import io.netty.util.concurrent.GenericFutureListener; import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; import org.opendaylight.controller.config.util.xml.DocumentedException; import org.opendaylight.controller.config.util.xml.XmlElement; import org.opendaylight.controller.config.util.xml.XmlUtil; @@ -37,17 +35,14 @@ import org.w3c.dom.Document; public class DefaultCloseSessionTest { - private void mockEventLoop(final Channel channel) { + private static void mockEventLoop(final Channel channel) { final EventLoop eventLoop = mock(EventLoop.class); doReturn(eventLoop).when(channel).eventLoop(); - doAnswer(new Answer() { - @Override - public Void answer(InvocationOnMock invocation) throws Throwable { - final Object[] args = invocation.getArguments(); - final Runnable runnable = (Runnable) args[0]; - runnable.run(); - return null; - } + doAnswer(invocation -> { + final Object[] args = invocation.getArguments(); + final Runnable runnable = (Runnable) args[0]; + runnable.run(); + return null; }).when(eventLoop).execute(any(Runnable.class)); doReturn(true).when(eventLoop).inEventLoop(); } @@ -67,12 +62,9 @@ public class DefaultCloseSessionTest { doReturn(channelFuture).when(channelFuture).addListener(any(GenericFutureListener.class)); final ChannelFuture sendFuture = mock(ChannelFuture.class); - doAnswer(new Answer() { - @Override - public Object answer(final InvocationOnMock invocation) throws Throwable { - ((GenericFutureListener) invocation.getArguments()[0]).operationComplete(sendFuture); - return null; - } + doAnswer(invocation -> { + ((GenericFutureListener) invocation.getArguments()[0]).operationComplete(sendFuture); + return null; }).when(sendFuture).addListener(any(GenericFutureListener.class)); doReturn(sendFuture).when(channel).writeAndFlush(anyObject()); doReturn(true).when(sendFuture).isSuccess();