import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.api.OFConstants;
//NOOP
}
};
- final Answer closeRequestFutureAnswer = new Answer() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- rqContext.setResult(rpcResult);
- rqContext.close();
- return null;
- }
+ final Answer closeRequestFutureAnswer = invocation -> {
+ rqContext.setResult(rpcResult);
+ rqContext.close();
+ return null;
};
Mockito.when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
Mockito.when(deviceInfo.getNodeId()).thenReturn(NODE_ID);
Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(null);
- Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class));
+ Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector)
+ .endCollecting(Matchers.any(EventIdentifier.class));
Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
.commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
service.handleAndNotify(input, notificationPublishService);
Assert.assertTrue(resultFuture.isDone());
- final RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> rpcResult = resultFuture.get();
- Assert.assertTrue(rpcResult.isSuccessful());
+ final RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> result = resultFuture.get();
+ Assert.assertTrue(result.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType());
- Mockito.verify(notificationPublishService, Mockito.timeout(500)).offerNotification(Matchers.any(AggregateFlowStatisticsUpdate.class));
+ Mockito.verify(notificationPublishService, Mockito.timeout(500))
+ .offerNotification(Matchers.any(AggregateFlowStatisticsUpdate.class));
}
-
}