X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=bgp%2Frib-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fbgp%2Frib%2Fimpl%2FFSMTest.java;fp=bgp%2Frib-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fbgp%2Frib%2Fimpl%2FFSMTest.java;h=7aa31be9dc7f058c430ee356ba92cc06354ba8d3;hb=5604385a16f8b0080fd3c859d2268d45b816c3eb;hp=c5bb5576dc55214bb95c54173ce1131a3c1a1e16;hpb=7576c5924cc21997ff456635659f5c7c162f2804;p=bgpcep.git diff --git a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/FSMTest.java b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/FSMTest.java index c5bb5576dc..7aa31be9dc 100644 --- a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/FSMTest.java +++ b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/FSMTest.java @@ -36,8 +36,6 @@ import org.junit.Test; import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; import org.opendaylight.protocol.bgp.parser.BGPError; import org.opendaylight.protocol.bgp.parser.BgpExtendedMessageUtil; import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl; @@ -119,13 +117,10 @@ public class FSMTest { doReturn(null).when(f).addListener(any(GenericFutureListener.class)); final InetAddress peerAddress = InetAddress.getByName("1.1.1.2"); - doAnswer(new Answer() { - @Override - public Object answer(final InvocationOnMock invocation) { - final Object[] args = invocation.getArguments(); - FSMTest.this.receivedMsgs.add((Notification) args[0]); - return f; - } + doAnswer(invocation -> { + final Object[] args = invocation.getArguments(); + FSMTest.this.receivedMsgs.add((Notification) args[0]); + return f; }).when(this.speakerListener).writeAndFlush(any(Notification.class)); doReturn(this.eventLoop).when(this.speakerListener).eventLoop(); doReturn(null).when(this.eventLoop).schedule(any(Runnable.class), any(long.class), any(TimeUnit.class)); @@ -141,7 +136,7 @@ public class FSMTest { final BGPPeerRegistry peerRegistry = new StrictBGPPeerRegistry(); peerRegistry.addPeer(new IpAddress(new Ipv4Address(peerAddress.getHostAddress())), new SimpleSessionListener(), prefs); - this.clientSession = new BGPClientSessionNegotiator(new DefaultPromise(GlobalEventExecutor.INSTANCE), this.speakerListener, peerRegistry); + this.clientSession = new BGPClientSessionNegotiator(new DefaultPromise<>(GlobalEventExecutor.INSTANCE), this.speakerListener, peerRegistry); this.classicOpen = new OpenBuilder().setMyAsNumber(30).setHoldTimer(3).setVersion(new ProtocolVersion((short) 4)).setBgpParameters( tlvs).setBgpIdentifier(new Ipv4Address("1.1.1.2")).build(); @@ -149,7 +144,7 @@ public class FSMTest { @Test public void testDenyPeer() { - this.clientSession = new BGPClientSessionNegotiator(new DefaultPromise(GlobalEventExecutor.INSTANCE), this.speakerListener, new StrictBGPPeerRegistry()); + this.clientSession = new BGPClientSessionNegotiator(new DefaultPromise<>(GlobalEventExecutor.INSTANCE), this.speakerListener, new StrictBGPPeerRegistry()); this.clientSession.channelActive(null); assertEquals(1, this.receivedMsgs.size()); assertTrue(this.receivedMsgs.get(0) instanceof Notify);