### Question:
OrderOtherServiceImpl implements OrderOtherService { @Override public Response updateOrder(Order order, HttpHeaders headers) { LOGGER.info("UPDATE ORDER INFO :" + order.toString()); Order oldOrder = orderOtherRepository.findById(order.getId()); if (oldOrder == null) { OrderOtherServiceImpl.LOGGER.info("[Order Service][Admin Update Order] Fail.Order not found."); return new Response<>(0, orderNotFound, null); } else { OrderOtherServiceImpl.LOGGER.info("{}", oldOrder.toString()); oldOrder.setAccountId(order.getAccountId()); oldOrder.setBoughtDate(order.getBoughtDate()); oldOrder.setTravelDate(order.getTravelDate()); oldOrder.setTravelTime(order.getTravelTime()); oldOrder.setCoachNumber(order.getCoachNumber()); oldOrder.setSeatClass(order.getSeatClass()); oldOrder.setSeatNumber(order.getSeatNumber()); oldOrder.setFrom(order.getFrom()); oldOrder.setTo(order.getTo()); oldOrder.setStatus(order.getStatus()); oldOrder.setTrainNumber(order.getTrainNumber()); oldOrder.setPrice(order.getPrice()); oldOrder.setContactsName(order.getContactsName()); oldOrder.setContactsDocumentNumber(order.getContactsDocumentNumber()); oldOrder.setDocumentType(order.getDocumentType()); orderOtherRepository.save(oldOrder); OrderOtherServiceImpl.LOGGER.info("[Order Service] [Admin Update Order] Success."); return new Response<>(1, success, oldOrder); } }  @Override Response getSoldTickets(Seat seatRequest, HttpHeaders headers); @Override Response findOrderById(UUID id, HttpHeaders headers); @Override Response create(Order order, HttpHeaders headers); @Override void initOrder(Order order, HttpHeaders headers); @Override Response alterOrder(OrderAlterInfo oai, HttpHeaders headers); @Override Response<ArrayList<Order>> queryOrders(QueryInfo qi, String accountId, HttpHeaders headers); @Override Response queryOrdersForRefresh(QueryInfo 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 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 testUpdateOrder1() { Order order = new Order(); Mockito.when(orderOtherRepository.findById(Mockito.any(UUID.class))).thenReturn(null); Response result = orderOtherServiceImpl.updateOrder(order, headers); Assert.assertEquals(new Response<>(0, "Order Not Found", null), result); }
@Test public void testUpdateOrder2() { Order order = new Order(); Mockito.when(orderOtherRepository.findById(Mockito.any(UUID.class))).thenReturn(order); Mockito.when(orderOtherRepository.save(Mockito.any(Order.class))).thenReturn(null); Response result = orderOtherServiceImpl.updateOrder(order, headers); Assert.assertEquals("Success", result.getMsg()); }