BUG-8007: Code Clean Up
[bgpcep.git] / bgp / rib-impl / src / test / java / org / opendaylight / protocol / bgp / rib / impl / BGPSessionImplTest.java
index ceed3ee4a8422972e633f5e13292ab96b8018a70..01609a9de397b83a4e450ac68818d4c6d3f7f194 100644 (file)
@@ -37,8 +37,6 @@ import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.config.yang.bgp.rib.impl.BgpSessionState;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPError;
@@ -116,25 +114,19 @@ public class BGPSessionImplTest {
         final ChannelFuture f = mock(ChannelFuture.class);
         doReturn(null).when(f).addListener(Mockito.<GenericFutureListener<? extends Future<? super Void>>>any());
 
-        doAnswer(new Answer<Object>() {
-            @Override
-            public Object answer(final InvocationOnMock invocation) {
-                final Object[] args = invocation.getArguments();
-                BGPSessionImplTest.this.receivedMsgs.add((Notification) args[0]);
-                return f;
-            }
+        doAnswer(invocation -> {
+            final Object[] args = invocation.getArguments();
+            BGPSessionImplTest.this.receivedMsgs.add((Notification) args[0]);
+            return f;
         }).when(this.speakerListener).writeAndFlush(Mockito.any(Notification.class));
         doReturn(this.eventLoop).when(this.speakerListener).eventLoop();
         doReturn(true).when(this.speakerListener).isActive();
-        doAnswer(new Answer<Void>() {
-            @Override
-            public Void answer(final InvocationOnMock invocation) throws Throwable {
-                final Runnable command = (Runnable) invocation.getArguments()[0];
-                final long delay = (long) invocation.getArguments()[1];
-                final TimeUnit unit = (TimeUnit) invocation.getArguments()[2];
-                GlobalEventExecutor.INSTANCE.schedule(command, delay, unit);
-                return null;
-            }
+        doAnswer(invocation -> {
+            final Runnable command = (Runnable) invocation.getArguments()[0];
+            final long delay = (long) invocation.getArguments()[1];
+            final TimeUnit unit = (TimeUnit) invocation.getArguments()[2];
+            GlobalEventExecutor.INSTANCE.schedule(command, delay, unit);
+            return null;
         }).when(this.eventLoop).schedule(Mockito.any(Runnable.class), Mockito.any(long.class), Mockito.any(TimeUnit.class));
         doReturn("TestingChannel").when(this.speakerListener).toString();
         doReturn(true).when(this.speakerListener).isWritable();
@@ -172,8 +164,8 @@ public class BGPSessionImplTest {
         assertEquals(BGP_ID.getValue(), state.getLocalPeerPreferences().getBgpId().getValue());
         assertEquals(1, state.getLocalPeerPreferences().getAdvertizedTableTypes().size());
         assertEquals(HOLD_TIMER, state.getLocalPeerPreferences().getHoldtimer().intValue());
-        assertTrue(state.getLocalPeerPreferences().getFourOctetAsCapability().booleanValue());
-        assertTrue(state.getLocalPeerPreferences().getBgpExtendedMessageCapability().booleanValue());
+        assertTrue(state.getLocalPeerPreferences().getFourOctetAsCapability());
+        assertTrue(state.getLocalPeerPreferences().getBgpExtendedMessageCapability());
         assertTrue(state.getLocalPeerPreferences().getGrCapability());
         assertEquals(LOCAL_IP, new String(state.getRemotePeerPreferences().getHost().getValue()));
         assertEquals(LOCAL_PORT, state.getRemotePeerPreferences().getPort().getValue().intValue());