package com.usoft.fin.grpc.service.impl;

import com.usoft.fin.grpc.BaseTest;
import com.usoft.fin.grpc.api.protobuf.GetRepayPlanInfoRequest;
import com.usoft.fin.grpc.api.protobuf.GetRepayPlanInfoResponse;
import com.usoft.fin.grpc.api.protobuf.IRepayGrpcServiceGrpc;
import com.usoft.protobuf.utils.ProtoBufUtil;
import org.junit.jupiter.api.Test;
import org.springframework.util.Assert;

/**
 * @author wangmh
 * @date 2018/8/24.
 */
class RepayGrpcServiceImplTest extends BaseTest {

    IRepayGrpcServiceGrpc.IRepayGrpcServiceBlockingStub repayGSBS = IRepayGrpcServiceGrpc.newBlockingStub(this.grpcChannel);

    @Test
    public void getRepayPlans() {
        GetRepayPlanInfoRequest.Builder builder = GetRepayPlanInfoRequest.newBuilder();
        builder.setDrawApplyCode("1");
        GetRepayPlanInfoResponse response = repayGSBS.getRepayPlanInfo(builder.build());
        Assert.isTrue(response.getResponseHeader().getCode() == 0, response.getResponseHeader().getMsg());
        System.out.println("------返回结果--------");
        System.out.println(ProtoBufUtil.toJSONHasTryCatch(response));
    }
}