admin
2025-05-09 6159dc58f50d3e4680779b7989bbd4d49a76bad5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.taoke.autopay.credit;
 
import com.taoke.autopay.entity.credit.CreditExchangeRecord;
import com.taoke.autopay.exception.UserCreditException;
import com.taoke.autopay.exception.UserCreditExchangeException;
import com.taoke.autopay.manager.UserCreditExchangeManager;
import com.taoke.autopay.manager.UserCreditManager;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
 
import javax.annotation.Resource;
 
@SpringBootTest
public class CreditExchangeTest {
    @Resource
    private UserCreditExchangeManager userCreditExchangeManager;
 
    @Test
    public void exchangeCredit() throws  UserCreditExchangeException {
        userCreditExchangeManager.exchangeCredit(CreditExchangeRecord.builder()
                        .exchangeType(CreditExchangeRecord.ExchangeType.FUND_EXCHANGE)
                        .consumedCredits(100)
                        .uid(2L)
                .build());
    }
 
    @Test
    public void pass() throws UserCreditExchangeException {
        userCreditExchangeManager.approveExchange(2L);
    }
 
    @Test
    public void reject() throws UserCreditExchangeException {
        userCreditExchangeManager.rejectExchange(1L);
    }
 
 
}