### Question:
OrderServiceImpl implements OrderService { @Override public Response deleteOrder(String orderId, HttpHeaders headers) { UUID orderUuid = UUID.fromString(orderId); Order order = orderRepository.findById(orderUuid); if (order == null) { return new Response<>(0, "Order Not Exist.", null); } else { orderRepository.deleteById(orderUuid); return new Response<>(1, "Delete Order Success", order); } }  @Override Response getSoldTickets(Seat seatRequest, HttpHeaders headers); @Override Response findOrderById(UUID id, HttpHeaders headers); @Override Response create(Order order, HttpHeaders headers); @Override Response alterOrder(OrderAlterInfo oai, HttpHeaders headers); @Override Response<ArrayList<Order>> queryOrders(OrderInfo qi, String accountId, HttpHeaders headers); @Override Response queryOrdersForRefresh(OrderInfo qi, String accountId, HttpHeaders headers); List<String> queryForStationId(List<String> ids, HttpHeaders headers); @Override Response saveChanges(Order order, HttpHeaders headers); @Override Response cancelOrder(UUID accountId, UUID orderId, HttpHeaders headers); @Override Response queryAlreadySoldOrders(Date travelDate, String trainNumber, HttpHeaders headers); @Override Response getAllOrders(HttpHeaders headers); @Override Response modifyOrder(String orderId, int status, HttpHeaders headers); @Override Response getOrderPrice(String orderId, HttpHeaders headers); @Override Response payOrder(String orderId, HttpHeaders headers); @Override Response getOrderById(String orderId, HttpHeaders headers); @Override void initOrder(Order order, HttpHeaders headers); @Override Response checkSecurityAboutOrder(Date dateFrom, String accountId, HttpHeaders headers); @Override Response deleteOrder(String orderId, HttpHeaders headers); @Override Response addNewOrder(Order order, HttpHeaders headers); @Override Response updateOrder(Order order, HttpHeaders headers);  }### Answer:
@Test public void testDeleteOrder1() { Mockito.when(orderRepository.findById(Mockito.any(UUID.class))).thenReturn(null); Response result = orderServiceImpl.deleteOrder(UUID.randomUUID().toString(), headers); Assert.assertEquals(new Response<>(0, "Order Not Exist.", null), result); }
@Test public void testDeleteOrder2() { Order order = new Order(); UUID orderUuid = UUID.randomUUID(); Mockito.when(orderRepository.findById(Mockito.any(UUID.class))).thenReturn(order); Mockito.doNothing().doThrow(new RuntimeException()).when(orderRepository).deleteById(Mockito.any(UUID.class)); Response result = orderServiceImpl.deleteOrder(orderUuid.toString(), headers); Assert.assertEquals(new Response<>(1, "Delete Order Success", order), result); }