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;
public void setUp() throws Exception {
salFlowsBatchService = new SalFlowsBatchServiceImpl(salFlowService, transactionService);
- Mockito.when(transactionService.sendBarrier(Matchers.<SendBarrierInput>any()))
+ Mockito.when(transactionService.sendBarrier(ArgumentMatchers.<SendBarrierInput>any()))
.thenReturn(RpcResultBuilder.<SendBarrierOutput>success().buildFuture());
}
@Test
public void testRemoveFlowsBatch_success() throws Exception {
- Mockito.when(salFlowService.removeFlow(Matchers.<RemoveFlowInput>any()))
+ Mockito.when(salFlowService.removeFlow(ArgumentMatchers.<RemoveFlowInput>any()))
.thenReturn(RpcResultBuilder.success(new RemoveFlowOutputBuilder().build())
.buildFuture());
Assert.assertEquals(42, allValues.get(0).getPriority().longValue());
Assert.assertEquals(43, allValues.get(1).getPriority().longValue());
- inOrder.verify(transactionService).sendBarrier(Matchers.<SendBarrierInput>any());
+ inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.<SendBarrierInput>any());
}
@Test
public void testRemoveFlowsBatch_failed() throws Exception {
- Mockito.when(salFlowService.removeFlow(Matchers.<RemoveFlowInput>any()))
+ Mockito.when(salFlowService.removeFlow(ArgumentMatchers.<RemoveFlowInput>any()))
.thenReturn(RpcResultBuilder.<RemoveFlowOutput>failed()
.withError(RpcError.ErrorType.APPLICATION, "flow-remove-fail-1")
.buildFuture());
Assert.assertEquals(42, allValues.get(0).getPriority().longValue());
Assert.assertEquals(43, allValues.get(1).getPriority().longValue());
- inOrder.verify(transactionService).sendBarrier(Matchers.<SendBarrierInput>any());
+ inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.<SendBarrierInput>any());
}
private static BatchAddFlows createEmptyBatchAddFlow(final String flowIdValue, final int priority) {
@Test
public void testAddFlowsBatch_success() throws Exception {
- Mockito.when(salFlowService.addFlow(Matchers.<AddFlowInput>any()))
+ Mockito.when(salFlowService.addFlow(ArgumentMatchers.<AddFlowInput>any()))
.thenReturn(RpcResultBuilder.success(new AddFlowOutputBuilder().build()).buildFuture());
final AddFlowsBatchInput input = new AddFlowsBatchInputBuilder()
Assert.assertEquals(42, allValues.get(0).getPriority().longValue());
Assert.assertEquals(43, allValues.get(1).getPriority().longValue());
- inOrder.verify(transactionService).sendBarrier(Matchers.<SendBarrierInput>any());
+ inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.<SendBarrierInput>any());
}
@Test
public void testAddFlowsBatch_failed() throws Exception {
- Mockito.when(salFlowService.addFlow(Matchers.<AddFlowInput>any()))
+ Mockito.when(salFlowService.addFlow(ArgumentMatchers.<AddFlowInput>any()))
.thenReturn(RpcResultBuilder
.<AddFlowOutput>failed().withError(RpcError.ErrorType.APPLICATION, "ut-groupAddError")
.buildFuture());
Assert.assertEquals(42, allValues.get(0).getPriority().longValue());
Assert.assertEquals(43, allValues.get(1).getPriority().longValue());
- inOrder.verify(transactionService).sendBarrier(Matchers.<SendBarrierInput>any());
+ inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.<SendBarrierInput>any());
}
@Test
public void testUpdateFlowsBatch_success() throws Exception {
- Mockito.when(salFlowService.updateFlow(Matchers.<UpdateFlowInput>any()))
+ Mockito.when(salFlowService.updateFlow(ArgumentMatchers.<UpdateFlowInput>any()))
.thenReturn(RpcResultBuilder.success(new UpdateFlowOutputBuilder().build()).buildFuture());
final UpdateFlowsBatchInput input = new UpdateFlowsBatchInputBuilder()
Assert.assertEquals(44, allValues.get(1).getOriginalFlow().getPriority().longValue());
Assert.assertEquals(45, allValues.get(1).getUpdatedFlow().getPriority().longValue());
- inOrder.verify(transactionService).sendBarrier(Matchers.<SendBarrierInput>any());
+ inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.<SendBarrierInput>any());
}
@Test
public void testUpdateFlowsBatch_failure() throws Exception {
- Mockito.when(salFlowService.updateFlow(Matchers.<UpdateFlowInput>any()))
+ Mockito.when(salFlowService.updateFlow(ArgumentMatchers.<UpdateFlowInput>any()))
.thenReturn(RpcResultBuilder.<UpdateFlowOutput>failed()
.withError(RpcError.ErrorType.APPLICATION, "ut-flowUpdateError")
.buildFuture());
Assert.assertEquals(44, allValues.get(1).getOriginalFlow().getPriority().longValue());
Assert.assertEquals(45, allValues.get(1).getUpdatedFlow().getPriority().longValue());
- inOrder.verify(transactionService).sendBarrier(Matchers.<SendBarrierInput>any());
+ inOrder.verify(transactionService).sendBarrier(ArgumentMatchers.<SendBarrierInput>any());
}
}