use of cn.beecloud.entity.BCQueryBillsResult in project ttdj by soonphe.
the class BCQueryTest method testQueryBillsAsyncTestMode.
/**
* #7
* test mode
* @throws Exception
*/
@Test
public void testQueryBillsAsyncTestMode() throws Exception {
BeeCloud.setSandbox(true);
final BCHttpClientUtil.Response response = new BCHttpClientUtil.Response();
response.code = 200;
// please note this content is fake, there should be content for bills, here delete the record for the limit of space
response.content = "{\"result_msg\":\"OK\",\"err_detail\":\"\",\"result_code\":0,\"bills\":[{\"bill_no\":\"bc1447657931\"}]}";
// mock
PowerMockito.stub(PowerMockito.method(BCHttpClientUtil.class, "httpGet", String.class)).toReturn(response);
BCQuery.QueryParams queryParams = new BCQuery.QueryParams();
queryParams.channel = BCReqParams.BCChannelTypes.WX;
query.queryBillsAsync(queryParams, new BCCallback() {
@Override
public void done(BCResult result) {
Assert.assertTrue(result instanceof BCQueryBillsResult);
BCQueryBillsResult billsResult = (BCQueryBillsResult) result;
Assert.assertEquals((Integer) 0, billsResult.getResultCode());
Assert.assertEquals((int) billsResult.getCount(), billsResult.getBills().size());
BCBillOrder billOrder = billsResult.getBills().get(0);
Assert.assertEquals("bc1447657931", billOrder.getBillNum());
BeeCloud.setSandbox(false);
latch.countDown();
}
});
latch.await(2000, TimeUnit.MILLISECONDS);
}
use of cn.beecloud.entity.BCQueryBillsResult in project ttdj by soonphe.
the class BCQueryTest method testQueryBillsAsyncByChannel.
/**
* #4
* 测试根据支付渠道获取订单
* @throws Exception
*/
@Test
public void testQueryBillsAsyncByChannel() throws Exception {
final BCHttpClientUtil.Response response = new BCHttpClientUtil.Response();
response.code = 200;
// please note this content is fake, there should be content for bills, here delete the record for the limit of space
response.content = "{\"result_msg\":\"OK\",\"err_detail\":\"\",\"result_code\":0,\"bills\":[{\"bill_no\":\"bc1447657931\"}]}";
// mock
PowerMockito.stub(PowerMockito.method(BCHttpClientUtil.class, "httpGet", String.class)).toReturn(response);
query.queryBillsAsync(BCReqParams.BCChannelTypes.ALL, new BCCallback() {
@Override
public void done(BCResult result) {
Assert.assertTrue(result instanceof BCQueryBillsResult);
BCQueryBillsResult billsResult = (BCQueryBillsResult) result;
Assert.assertEquals((Integer) 0, billsResult.getResultCode());
Assert.assertEquals((int) billsResult.getCount(), billsResult.getBills().size());
BCBillOrder billOrder = billsResult.getBills().get(0);
Assert.assertEquals("bc1447657931", billOrder.getBillNum());
latch.countDown();
}
});
latch.await(2000, TimeUnit.MILLISECONDS);
}
Aggregations