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

import com.usoft.fin.grpc.BaseTest;
import com.usoft.fin.grpc.api.protobuf.GetCreditApplyInfoResponse;
import com.usoft.fin.grpc.api.protobuf.GetMessagesRequest;
import com.usoft.fin.grpc.api.protobuf.GetMessagesResponse;
import com.usoft.fin.grpc.api.protobuf.IMessageGrpcServiceGrpc;
import com.usoft.protobuf.utils.ProtoBufUtil;
import org.junit.jupiter.api.Test;
import org.springframework.util.Assert;

import static org.junit.jupiter.api.Assertions.*;

/**
 * @author: huyy
 * @date: 2018/9/6 17:06
 */
class MessageServiceImplTest extends BaseTest {

    IMessageGrpcServiceGrpc.IMessageGrpcServiceBlockingStub messageGSBS = IMessageGrpcServiceGrpc.newBlockingStub(this.grpcChannel);

    @Test
    void getMessages() {
        GetMessagesRequest.Builder request = GetMessagesRequest.newBuilder();
        request.setPageNumber(1);
        request.setPageSize(10);
        request.setMsReceiverenuu(10041166);
        request.setMsIsread(1);
        GetMessagesResponse response = messageGSBS.getMessages(request.build());
        Assert.isTrue(response.getResponseHeader().getCode() == 0, response.getResponseHeader().getMsg());
        System.out.println("------返回结果--------");
        System.out.println(ProtoBufUtil.toJSONHasTryCatch(response));
    }

}