mokito大家不陌生,之前一直这样用的:
@Resource
private AllocaStrategyBatchService allocaStrategyBatchService;
@Mock
private ITransProdSharesService transProdSharesService;
@Before
public void init(){
this.setField(allocaStrategyBatchService ,"transProdSharesService",transProdSharesService);
}
//1.正常付款-现金
@Test
public void test_pay_normal_cash_succ(){
//1.given
this.setUpDataSet("business/allocation/pay/batch/DistributionPayService_test_batch_pay_normal_cash_succ.xml");
//2.when
Mockito.when(transProdSharesService.allocateProductShares(Mockito.any(ProductSharesAllocateReq.class))).thenReturn(responseSucc());
//接口
distributionPayService.pay("AAO60010202000000311007144833" , PaymentMethodEnum.BATCH);
//MQ返回
distributionResultService.handlerResult(buildReturnMQ("ADO10010202000000312032143603&