use of cn.beecloud.entity.BCRefundStatus in project ttdj by soonphe.
the class BCQueryTest method testQueryRefundStatusAsyncRefundNumInvalid.
/**
* #2
* 输入退款单号为null的情况
* @throws Exception
*/
@Test
public void testQueryRefundStatusAsyncRefundNumInvalid() throws Exception {
query.queryRefundStatusAsync(BCReqParams.BCChannelTypes.WX, null, new BCCallback() {
@Override
public void done(BCResult result) {
Assert.assertTrue(result instanceof BCRefundStatus);
BCRefundStatus status = (BCRefundStatus) result;
Assert.assertEquals(BCRestfulCommonResult.APP_INNER_FAIL_NUM, status.getResultCode());
latch.countDown();
}
});
latch.await(2000, TimeUnit.MILLISECONDS);
}
use of cn.beecloud.entity.BCRefundStatus in project ttdj by soonphe.
the class BCQueryTest method testQueryRefundStatusAsyncTestMode.
/**
* #5
* test mode
* @throws Exception
*/
@Test
public void testQueryRefundStatusAsyncTestMode() throws Exception {
BeeCloud.setSandbox(true);
query.queryRefundStatusAsync(BCReqParams.BCChannelTypes.WX, "refundnum", new BCCallback() {
@Override
public void done(BCResult result) {
Assert.assertTrue(result instanceof BCRefundStatus);
BCRefundStatus status = (BCRefundStatus) result;
Assert.assertEquals(BCRestfulCommonResult.APP_INNER_FAIL_NUM, status.getResultCode());
Assert.assertEquals("该功能暂不支持测试模式", status.getErrDetail());
BeeCloud.setSandbox(false);
latch.countDown();
}
});
latch.await(2000, TimeUnit.MILLISECONDS);
}
use of cn.beecloud.entity.BCRefundStatus in project ttdj by soonphe.
the class BCQueryTest method testQueryRefundStatusAsyncChannelInvalid.
/**
* #1
* 测试channel非支持的情况
* @throws Exception
*/
@Test
public void testQueryRefundStatusAsyncChannelInvalid() throws Exception {
query.queryRefundStatusAsync(BCReqParams.BCChannelTypes.ALI, "refundnum", new BCCallback() {
@Override
public void done(BCResult result) {
Assert.assertTrue(result instanceof BCRefundStatus);
BCRefundStatus status = (BCRefundStatus) result;
Assert.assertEquals(BCRestfulCommonResult.APP_INNER_FAIL_NUM, status.getResultCode());
latch.countDown();
}
});
latch.await(2000, TimeUnit.MILLISECONDS);
}
use of cn.beecloud.entity.BCRefundStatus in project ttdj by soonphe.
the class BCQueryTest method testQueryRefundStatusAsyncSucc.
/**
* #4
* 网络请求200
* @throws Exception
*/
@Test
public void testQueryRefundStatusAsyncSucc() throws Exception {
final BCHttpClientUtil.Response response = new BCHttpClientUtil.Response();
response.code = 200;
response.content = "{\"result_msg\":\"OK\",\"refund_status\":\"SUCCESS\",\"resultCode\":0,\"errMsg\":\"OK:\",\"err_detail\":\"\",\"result_code\":0}";
// mock
PowerMockito.stub(PowerMockito.method(BCHttpClientUtil.class, "httpGet", String.class)).toReturn(response);
query.queryRefundStatusAsync(BCReqParams.BCChannelTypes.WX, "refundnum", new BCCallback() {
@Override
public void done(BCResult result) {
Assert.assertTrue(result instanceof BCRefundStatus);
BCRefundStatus status = (BCRefundStatus) result;
Assert.assertEquals((Integer) 0, status.getResultCode());
Assert.assertTrue(BCRefundStatus.RefundStatus.REFUND_STATUS_SUCCESS.equals(status.getRefundStatus()));
latch.countDown();
}
});
latch.await(2000, TimeUnit.MILLISECONDS);
}
use of cn.beecloud.entity.BCRefundStatus in project ttdj by soonphe.
the class BCQueryTest method testQueryRefundStatusAsyncNetworkError.
/**
* #3
* 网络请求400等异常情况
* @throws Exception
*/
@Test
public void testQueryRefundStatusAsyncNetworkError() throws Exception {
final BCHttpClientUtil.Response response = new BCHttpClientUtil.Response();
response.code = 400;
response.content = "wrong";
// mock
PowerMockito.stub(PowerMockito.method(BCHttpClientUtil.class, "httpGet", String.class)).toReturn(response);
query.queryRefundStatusAsync(BCReqParams.BCChannelTypes.WX, "refundnum", new BCCallback() {
@Override
public void done(BCResult result) {
Assert.assertTrue(result instanceof BCRefundStatus);
BCRefundStatus status = (BCRefundStatus) result;
Assert.assertEquals(BCRestfulCommonResult.APP_INNER_FAIL_NUM, status.getResultCode());
latch.countDown();
}
});
latch.await(2000, TimeUnit.MILLISECONDS);
}
Aggregations