### Question:
InsidePaymentServiceImpl implements InsidePaymentService { @Override public Response queryAccount(HttpHeaders headers) { List<Balance> result = new ArrayList<>(); List<Money> list = addMoneyRepository.findAll(); Iterator<Money> ite = list.iterator(); HashMap<String, String> map = new HashMap<>(); while (ite.hasNext()) { Money addMoney = ite.next(); if (map.containsKey(addMoney.getUserId())) { BigDecimal money = new BigDecimal(map.get(addMoney.getUserId())); map.put(addMoney.getUserId(), money.add(new BigDecimal(addMoney.getMoney())).toString()); } else { map.put(addMoney.getUserId(), addMoney.getMoney()); } } Iterator ite1 = map.entrySet().iterator(); while (ite1.hasNext()) { Map.Entry entry = (Map.Entry) ite1.next(); String userId = (String) entry.getKey(); String money = (String) entry.getValue(); List<Payment> payments = paymentRepository.findByUserId(userId); Iterator<Payment> iterator = payments.iterator(); String totalExpand = "0"; while (iterator.hasNext()) { Payment p = iterator.next(); BigDecimal expand = new BigDecimal(totalExpand); totalExpand = expand.add(new BigDecimal(p.getPrice())).toString(); } String balanceMoney = new BigDecimal(money).subtract(new BigDecimal(totalExpand)).toString(); Balance balance = new Balance(); balance.setUserId(userId); balance.setBalance(balanceMoney); result.add(balance); } return new Response<>(1, "Success", result); }  @Override Response pay(PaymentInfo info, HttpHeaders headers); @Override Response createAccount(AccountInfo info, HttpHeaders headers); @Override Response addMoney(String userId, String money, HttpHeaders headers); @Override Response queryAccount(HttpHeaders headers); String queryAccount(String userId, HttpHeaders headers); @Override Response queryPayment(HttpHeaders headers); @Override Response drawBack(String userId, String money, HttpHeaders headers); @Override Response payDifference(PaymentInfo info, HttpHeaders headers); @Override Response queryAddMoney(HttpHeaders headers); @Override void initPayment(Payment payment, HttpHeaders headers); @Autowired
    public AddMoneyRepository addMoneyRepository; @Autowired
    public PaymentRepository paymentRepository; @Autowired
    public RestTemplate restTemplate; }### Answer:
@Test public void testQueryAccount() { List<Money> list = new ArrayList<>(); Mockito.when(addMoneyRepository.findAll()).thenReturn(list); Response result = insidePaymentServiceImpl.queryAccount(headers); Assert.assertEquals("Success", result.getMsg()); }