### Question:
WirecardProcessOrderCancellationAction extends ProcessOrderCancellationAction { @Override public String execute(OrderProcessModel process) throws Exception { LOG.info(START_MESSAGE); ServicesUtil.validateParameterNotNullStandardMessage("process", process); LOG.info(PROCESS_MESSAGE, process.getCode(), getClass().getSimpleName()); final OrderModel order = process.getOrder(); ServicesUtil.validateParameterNotNullStandardMessage("order", order); final OrderCancelRecordEntryModel orderCancelRecordEntryModel = getOrderCancelService().getPendingCancelRecordEntry(order); final OrderCancelResponse orderCancelResponse = createOrderCancelResponseFromCancelRecordEntry(order, orderCancelRecordEntryModel); getWirecardPOExecutionService().executeAuthorizationCancelOperation(order); getOrderCancelCallbackService().onOrderCancelResponse(orderCancelResponse); OrderStatus orderStatus = getUpdatedOrderStatus(order); order.setStatus(orderStatus); getModelService().save(order); LOG.info(STATUS_MESSAGE, order.getCode(), orderStatus.getCode()); return calculateTransitionResult(order); }  @Override String execute(OrderProcessModel process); @Required void setWirecardPOExecutionService(WirecardPOExecutionService wirecardPOExecutionService);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testCancelNullProcess() throws Exception { wirecardProcessOrderCancellationAction.execute(null); }
@Test(expected = IllegalArgumentException.class) public void testCancelNullOrder() throws Exception { OrderProcessModel process = new OrderProcessModel(); wirecardProcessOrderCancellationAction.execute(process); }
@Test public void testCancelAction() throws Exception { OrderModel order = new OrderModel(); OrderProcessModel process = new OrderProcessModel(); process.setOrder(order); when(orderEntry.getQuantity()).thenReturn(0L); when(orderEntry.getOrder()).thenReturn(order); when(orderEntry.getQuantityUnallocated()).thenReturn(0L); order.setEntries(Collections.singletonList(orderEntry)); OrderEntryCancelRecordEntryModel orderEntryCancelRecordEntry = new OrderEntryCancelRecordEntryModel(); orderEntryCancelRecordEntry.setNotes("Notes"); orderEntryCancelRecordEntry.setCancelRequestQuantity(0); orderEntryCancelRecordEntry.setCancelReason(CancelReason.OTHER); orderEntryCancelRecordEntry.setOrderEntry(orderEntry); OrderCancelRecordEntryModel orderCancelRecordEntry = new OrderCancelRecordEntryModel(); orderCancelRecordEntry.setOrderEntriesModificationEntries(Collections.singleton(orderEntryCancelRecordEntry)); orderCancelRecordEntry.setCancelResult(OrderCancelEntryStatus.PARTIAL); orderCancelRecordEntry.setNotes("Notes"); when(orderCancelService.getPendingCancelRecordEntry(order)).thenReturn(orderCancelRecordEntry); String transition = wirecardProcessOrderCancellationAction.execute(process); assertNotNull("Order status is null, ", order.getStatus()); assertEquals("Transition does not match", AbstractProceduralAction.Transition.OK.toString(), transition); }