### Question:
InsidePaymentServiceImpl implements InsidePaymentService { @Override public Response addMoney(String userId, String money, HttpHeaders headers) { if (addMoneyRepository.findByUserId(userId) != null) { Money addMoney = new Money(); addMoney.setUserId(userId); addMoney.setMoney(money); addMoney.setType(MoneyType.A); addMoneyRepository.save(addMoney); return new Response<>(1, "Add Money Success", null); } else { return new Response<>(0, "Add Money Failed", null); } }  @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 testAddMoney1() { List<Money> list = new ArrayList<>(); Mockito.when(addMoneyRepository.findByUserId(Mockito.anyString())).thenReturn(list); Mockito.when(addMoneyRepository.save(Mockito.any(Money.class))).thenReturn(null); Response result = insidePaymentServiceImpl.addMoney("user_id", "money", headers); Assert.assertEquals(new Response<>(1, "Add Money Success", null), result); }
@Test public void testAddMoney2() { Mockito.when(addMoneyRepository.findByUserId(Mockito.anyString())).thenReturn(null); Response result = insidePaymentServiceImpl.addMoney("user_id", "money", headers); Assert.assertEquals(new Response<>(0, "Add Money Failed", null), result); }