### Question:
OrderServiceImpl implements OrderService { @Override public Response checkSecurityAboutOrder(Date dateFrom, String accountId, HttpHeaders headers) { OrderSecurity result = new OrderSecurity(); ArrayList<Order> orders = orderRepository.findByAccountId(UUID.fromString(accountId)); int countOrderInOneHour = 0; int countTotalValidOrder = 0; Calendar ca = Calendar.getInstance(); ca.setTime(dateFrom); ca.add(Calendar.HOUR_OF_DAY, -1); dateFrom = ca.getTime(); for (Order order : orders) { if (order.getStatus() == OrderStatus.NOTPAID.getCode() || order.getStatus() == OrderStatus.PAID.getCode() || order.getStatus() == OrderStatus.COLLECTED.getCode()) { countTotalValidOrder += 1; } if (order.getBoughtDate().after(dateFrom)) { countOrderInOneHour += 1; } } result.setOrderNumInLastOneHour(countOrderInOneHour); result.setOrderNumOfValidOrder(countTotalValidOrder); return new Response<>(1, "Check Security Success . ", result); }  @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 testCheckSecurityAboutOrder() { ArrayList<Order> orders = new ArrayList<>(); Mockito.when(orderRepository.findByAccountId(Mockito.any(UUID.class))).thenReturn(orders); Response result = orderServiceImpl.checkSecurityAboutOrder(new Date(), UUID.randomUUID().toString(), headers); Assert.assertEquals(new Response<>(1, "Check Security Success . ", new OrderSecurity(0, 0)), result); }