import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
import org.mockito.Captor;
import org.mockito.InOrder;
-import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
@Test
public void testProcessFlatBatch_allSuccessFinished() throws Exception {
- Mockito.when(salFlowsBatchService.addFlowsBatch(Matchers.<AddFlowsBatchInput>any()))
+ Mockito.when(salFlowsBatchService.addFlowsBatch(ArgumentMatchers.<AddFlowsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new AddFlowsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salFlowsBatchService.removeFlowsBatch(Matchers.<RemoveFlowsBatchInput>any()))
+ Mockito.when(salFlowsBatchService.removeFlowsBatch(ArgumentMatchers.<RemoveFlowsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new RemoveFlowsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salFlowsBatchService.updateFlowsBatch(Matchers.<UpdateFlowsBatchInput>any()))
+ Mockito.when(salFlowsBatchService.updateFlowsBatch(ArgumentMatchers.<UpdateFlowsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new UpdateFlowsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salGroupsBatchService.addGroupsBatch(Matchers.<AddGroupsBatchInput>any()))
+ Mockito.when(salGroupsBatchService.addGroupsBatch(ArgumentMatchers.<AddGroupsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new AddGroupsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salGroupsBatchService.removeGroupsBatch(Matchers.<RemoveGroupsBatchInput>any()))
+ Mockito.when(salGroupsBatchService.removeGroupsBatch(ArgumentMatchers.<RemoveGroupsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new RemoveGroupsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salGroupsBatchService.updateGroupsBatch(Matchers.<UpdateGroupsBatchInput>any()))
+ Mockito.when(salGroupsBatchService.updateGroupsBatch(ArgumentMatchers.<UpdateGroupsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new UpdateGroupsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salMetersBatchService.addMetersBatch(Matchers.<AddMetersBatchInput>any()))
+ Mockito.when(salMetersBatchService.addMetersBatch(ArgumentMatchers.<AddMetersBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new AddMetersBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salMetersBatchService.removeMetersBatch(Matchers.<RemoveMetersBatchInput>any()))
+ Mockito.when(salMetersBatchService.removeMetersBatch(ArgumentMatchers.<RemoveMetersBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new RemoveMetersBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salMetersBatchService.updateMetersBatch(Matchers.<UpdateMetersBatchInput>any()))
+ Mockito.when(salMetersBatchService.updateMetersBatch(ArgumentMatchers.<UpdateMetersBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new UpdateMetersBatchOutputBuilder().build()).buildFuture());
Assert.assertTrue(rpcResult.getResult().getBatchFailure().isEmpty());
final InOrder inOrder = Mockito.inOrder(salFlowsBatchService, salGroupsBatchService, salMetersBatchService);
- inOrder.verify(salFlowsBatchService).addFlowsBatch(Matchers.<AddFlowsBatchInput>any());
- inOrder.verify(salFlowsBatchService).removeFlowsBatch(Matchers.<RemoveFlowsBatchInput>any());
- inOrder.verify(salFlowsBatchService).updateFlowsBatch(Matchers.<UpdateFlowsBatchInput>any());
+ inOrder.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.<AddFlowsBatchInput>any());
+ inOrder.verify(salFlowsBatchService).removeFlowsBatch(ArgumentMatchers.<RemoveFlowsBatchInput>any());
+ inOrder.verify(salFlowsBatchService).updateFlowsBatch(ArgumentMatchers.<UpdateFlowsBatchInput>any());
- inOrder.verify(salGroupsBatchService).addGroupsBatch(Matchers.<AddGroupsBatchInput>any());
- inOrder.verify(salGroupsBatchService).removeGroupsBatch(Matchers.<RemoveGroupsBatchInput>any());
- inOrder.verify(salGroupsBatchService).updateGroupsBatch(Matchers.<UpdateGroupsBatchInput>any());
+ inOrder.verify(salGroupsBatchService).addGroupsBatch(ArgumentMatchers.<AddGroupsBatchInput>any());
+ inOrder.verify(salGroupsBatchService).removeGroupsBatch(ArgumentMatchers.<RemoveGroupsBatchInput>any());
+ inOrder.verify(salGroupsBatchService).updateGroupsBatch(ArgumentMatchers.<UpdateGroupsBatchInput>any());
- inOrder.verify(salMetersBatchService).addMetersBatch(Matchers.<AddMetersBatchInput>any());
- inOrder.verify(salMetersBatchService).removeMetersBatch(Matchers.<RemoveMetersBatchInput>any());
- inOrder.verify(salMetersBatchService).updateMetersBatch(Matchers.<UpdateMetersBatchInput>any());
+ inOrder.verify(salMetersBatchService).addMetersBatch(ArgumentMatchers.<AddMetersBatchInput>any());
+ inOrder.verify(salMetersBatchService).removeMetersBatch(ArgumentMatchers.<RemoveMetersBatchInput>any());
+ inOrder.verify(salMetersBatchService).updateMetersBatch(ArgumentMatchers.<UpdateMetersBatchInput>any());
}
@Test
Assert.assertEquals(3, rpcResult.getResult().getBatchFailure().get(0).getBatchOrder().intValue());
final InOrder inOrder = Mockito.inOrder(salFlowsBatchService, salGroupsBatchService, salMetersBatchService);
- inOrder.verify(salFlowsBatchService).addFlowsBatch(Matchers.<AddFlowsBatchInput>any());
- inOrder.verify(salFlowsBatchService).removeFlowsBatch(Matchers.<RemoveFlowsBatchInput>any());
- inOrder.verify(salFlowsBatchService).updateFlowsBatch(Matchers.<UpdateFlowsBatchInput>any());
- inOrder.verify(salGroupsBatchService).addGroupsBatch(Matchers.<AddGroupsBatchInput>any());
+ inOrder.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.<AddFlowsBatchInput>any());
+ inOrder.verify(salFlowsBatchService).removeFlowsBatch(ArgumentMatchers.<RemoveFlowsBatchInput>any());
+ inOrder.verify(salFlowsBatchService).updateFlowsBatch(ArgumentMatchers.<UpdateFlowsBatchInput>any());
+ inOrder.verify(salGroupsBatchService).addGroupsBatch(ArgumentMatchers.<AddGroupsBatchInput>any());
}
@Test
Assert.assertEquals(3, rpcResult.getResult().getBatchFailure().get(0).getBatchOrder().intValue());
final InOrder inOrder = Mockito.inOrder(salFlowsBatchService, salGroupsBatchService, salMetersBatchService);
- inOrder.verify(salFlowsBatchService).addFlowsBatch(Matchers.<AddFlowsBatchInput>any());
- inOrder.verify(salFlowsBatchService).removeFlowsBatch(Matchers.<RemoveFlowsBatchInput>any());
- inOrder.verify(salFlowsBatchService).updateFlowsBatch(Matchers.<UpdateFlowsBatchInput>any());
+ inOrder.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.<AddFlowsBatchInput>any());
+ inOrder.verify(salFlowsBatchService).removeFlowsBatch(ArgumentMatchers.<RemoveFlowsBatchInput>any());
+ inOrder.verify(salFlowsBatchService).updateFlowsBatch(ArgumentMatchers.<UpdateFlowsBatchInput>any());
- inOrder.verify(salGroupsBatchService).addGroupsBatch(Matchers.<AddGroupsBatchInput>any());
- inOrder.verify(salGroupsBatchService).removeGroupsBatch(Matchers.<RemoveGroupsBatchInput>any());
- inOrder.verify(salGroupsBatchService).updateGroupsBatch(Matchers.<UpdateGroupsBatchInput>any());
+ inOrder.verify(salGroupsBatchService).addGroupsBatch(ArgumentMatchers.<AddGroupsBatchInput>any());
+ inOrder.verify(salGroupsBatchService).removeGroupsBatch(ArgumentMatchers.<RemoveGroupsBatchInput>any());
+ inOrder.verify(salGroupsBatchService).updateGroupsBatch(ArgumentMatchers.<UpdateGroupsBatchInput>any());
- inOrder.verify(salMetersBatchService).addMetersBatch(Matchers.<AddMetersBatchInput>any());
- inOrder.verify(salMetersBatchService).removeMetersBatch(Matchers.<RemoveMetersBatchInput>any());
- inOrder.verify(salMetersBatchService).updateMetersBatch(Matchers.<UpdateMetersBatchInput>any());
+ inOrder.verify(salMetersBatchService).addMetersBatch(ArgumentMatchers.<AddMetersBatchInput>any());
+ inOrder.verify(salMetersBatchService).removeMetersBatch(ArgumentMatchers.<RemoveMetersBatchInput>any());
+ inOrder.verify(salMetersBatchService).updateMetersBatch(ArgumentMatchers.<UpdateMetersBatchInput>any());
}
private void prepareFirstFailingMockService() {
- Mockito.when(salFlowsBatchService.addFlowsBatch(Matchers.<AddFlowsBatchInput>any()))
+ Mockito.when(salFlowsBatchService.addFlowsBatch(ArgumentMatchers.<AddFlowsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new AddFlowsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salFlowsBatchService.removeFlowsBatch(Matchers.<RemoveFlowsBatchInput>any()))
+ Mockito.when(salFlowsBatchService.removeFlowsBatch(ArgumentMatchers.<RemoveFlowsBatchInput>any()))
.thenReturn(RpcResultBuilder.<RemoveFlowsBatchOutput>failed()
.withResult(new RemoveFlowsBatchOutputBuilder()
.setBatchFailedFlowsOutput(Lists.newArrayList(
.build())
.withError(RpcError.ErrorType.APPLICATION, "ut-firstFlowAddError")
.buildFuture());
- Mockito.when(salFlowsBatchService.updateFlowsBatch(Matchers.<UpdateFlowsBatchInput>any()))
+ Mockito.when(salFlowsBatchService.updateFlowsBatch(ArgumentMatchers.<UpdateFlowsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new UpdateFlowsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salGroupsBatchService.addGroupsBatch(Matchers.<AddGroupsBatchInput>any()))
+ Mockito.when(salGroupsBatchService.addGroupsBatch(ArgumentMatchers.<AddGroupsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new AddGroupsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salGroupsBatchService.removeGroupsBatch(Matchers.<RemoveGroupsBatchInput>any()))
+ Mockito.when(salGroupsBatchService.removeGroupsBatch(ArgumentMatchers.<RemoveGroupsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new RemoveGroupsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salGroupsBatchService.updateGroupsBatch(Matchers.<UpdateGroupsBatchInput>any()))
+ Mockito.when(salGroupsBatchService.updateGroupsBatch(ArgumentMatchers.<UpdateGroupsBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new UpdateGroupsBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salMetersBatchService.addMetersBatch(Matchers.<AddMetersBatchInput>any()))
+ Mockito.when(salMetersBatchService.addMetersBatch(ArgumentMatchers.<AddMetersBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new AddMetersBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salMetersBatchService.removeMetersBatch(Matchers.<RemoveMetersBatchInput>any()))
+ Mockito.when(salMetersBatchService.removeMetersBatch(ArgumentMatchers.<RemoveMetersBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new RemoveMetersBatchOutputBuilder().build()).buildFuture());
- Mockito.when(salMetersBatchService.updateMetersBatch(Matchers.<UpdateMetersBatchInput>any()))
+ Mockito.when(salMetersBatchService.updateMetersBatch(ArgumentMatchers.<UpdateMetersBatchInput>any()))
.thenReturn(RpcResultBuilder.success(new UpdateMetersBatchOutputBuilder().build()).buildFuture());
}
createFlowBatchFailure(1, "f2")))
.buildFuture();
- Mockito.when(batchStepJob1.getStepFunction().apply(Matchers.<RpcResult<ProcessFlatBatchOutput>>any()))
+ Mockito.when(batchStepJob1.getStepFunction().apply(ArgumentMatchers.<RpcResult<ProcessFlatBatchOutput>>any()))
.thenReturn(succeededChainOutput);
- Mockito.when(batchStepJob2.getStepFunction().apply(Matchers.<RpcResult<ProcessFlatBatchOutput>>any()))
+ Mockito.when(batchStepJob2.getStepFunction().apply(ArgumentMatchers.<RpcResult<ProcessFlatBatchOutput>>any()))
.thenReturn(failedChainOutput);
final List<BatchStepJob> batchChainElements = Lists.newArrayList(batchStepJob1, batchStepJob2);
Assert.assertEquals(1, batchChain.size());
- Mockito.when(salFlowsBatchService.addFlowsBatch(Matchers.<AddFlowsBatchInput>any()))
+ Mockito.when(salFlowsBatchService.addFlowsBatch(ArgumentMatchers.<AddFlowsBatchInput>any()))
.thenReturn(RpcResultBuilder
.success(new AddFlowsBatchOutputBuilder().build())
.buildFuture());
Assert.assertEquals(0, rpcResult.getErrors().size());
Assert.assertEquals(0, rpcResult.getResult().getBatchFailure().size());
- Mockito.verify(salFlowsBatchService).addFlowsBatch(Matchers.<AddFlowsBatchInput>any());
+ Mockito.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.<AddFlowsBatchInput>any());
}
@Test
Assert.assertEquals(2, batchChain.size());
- Mockito.when(salFlowsBatchService.addFlowsBatch(Matchers.<AddFlowsBatchInput>any()))
+ Mockito.when(salFlowsBatchService.addFlowsBatch(ArgumentMatchers.<AddFlowsBatchInput>any()))
.thenReturn(RpcResultBuilder
.<AddFlowsBatchOutput>failed()
.withResult(new AddFlowsBatchOutputBuilder()