### Question:
OrderOtherServiceImpl implements OrderOtherService { @Override public Response create(Order order, HttpHeaders headers) { OrderOtherServiceImpl.LOGGER.info("[Order Other Service][Create Order] Ready Create Order"); ArrayList<Order> accountOrders = orderOtherRepository.findByAccountId(order.getAccountId()); if (accountOrders.contains(order)) { OrderOtherServiceImpl.LOGGER.info("[Order Other Service][Order Create] Fail.Order already exists."); return new Response<>(0, "Order already exist", order); } else { order.setId(UUID.randomUUID()); orderOtherRepository.save(order); OrderOtherServiceImpl.LOGGER.info("[Order Other Service][Order Create] Success."); OrderOtherServiceImpl.LOGGER.info("[Order Other Service][Order Create] Price: {}", order.getPrice()); return new Response<>(1, success, order); } }  @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 testCreate1() { Order order = new Order(); ArrayList<Order> accountOrders = new ArrayList<>(); accountOrders.add(order); Mockito.when(orderOtherRepository.findByAccountId(Mockito.any(UUID.class))).thenReturn(accountOrders); Response result = orderOtherServiceImpl.create(order, headers); Assert.assertEquals(new Response<>(0, "Order already exist", order), result); }
@Test public void testCreate2() { Order order = new Order(); ArrayList<Order> accountOrders = new ArrayList<>(); Mockito.when(orderOtherRepository.findByAccountId(Mockito.any(UUID.class))).thenReturn(accountOrders); Mockito.when(orderOtherRepository.save(Mockito.any(Order.class))).thenReturn(null); Response result = orderOtherServiceImpl.create(order, headers); Assert.assertEquals("Success", result.getMsg()); }