import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
import org.mockito.Captor;
-import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.stubbing.OngoingStubbing;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
-import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
import org.opendaylight.openflowplugin.impl.services.multilayer.MultiLayerMultipartRequestCallback;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutputBuilder;
private AbstractMultipartRequestCallback<MultipartReply> multipartRequestCallback;
@Before
- public void setUp() throws Exception {
+ public void setUp() {
Mockito.doNothing().when(requestContext).setResult(rpcResultCapt.capture());
Mockito.when(deviceContext.getMessageSpy()).thenReturn(spy);
final OngoingStubbing<MultiMsgCollector<MultipartReply>> when =
- Mockito.when(deviceContext.getMultiMsgCollector(Matchers.any()));
+ Mockito.when(deviceContext.getMultiMsgCollector(ArgumentMatchers.any()));
when.thenReturn(multiMsgCollector);
multipartRequestCallback = new MultiLayerMultipartRequestCallback<>(requestContext,
MultipartRequestInput.class,
* End collecting.
*/
@Test
- public void testOnSuccess1() throws Exception {
+ public void testOnSuccess1() {
multipartRequestCallback.onSuccess(null);
- Mockito.verify(multiMsgCollector).endCollecting(Matchers.<EventIdentifier>any());
+ Mockito.verify(multiMsgCollector).endCollecting(ArgumentMatchers.any());
}
/**
* Fail adding to collection.
*/
@Test
- public void testOnSuccess2() throws Exception {
+ public void testOnSuccess2() {
multipartRequestCallback.onSuccess(new EchoOutputBuilder().build());
final RpcResult<List<MultipartReply>> rpcResult = rpcResultCapt.getValue();
Assert.assertNotNull(rpcResult);
* Successfully added to collection.
*/
@Test
- public void testOnSuccess3() throws Exception {
+ public void testOnSuccess3() {
final MultipartReplyMessage replyMessage = new MultipartReplyMessageBuilder().build();
multipartRequestCallback.onSuccess(replyMessage);
Mockito.verify(multiMsgCollector)
- .addMultipartMsg(Matchers.eq(replyMessage), Matchers.eq(false), Matchers.any());
+ .addMultipartMsg(ArgumentMatchers.eq(replyMessage), ArgumentMatchers.eq(false), ArgumentMatchers.any());
}
}