@Override
    public GlobalBeginResponseProto convert2Proto(GlobalBeginResponse globalBeginResponse) {
        final short typeCode = globalBeginResponse.getTypeCode();

        final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(
            MessageTypeProto.forNumber(typeCode)).build();

        final String msg = globalBeginResponse.getMsg();
        final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(
            msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(globalBeginResponse.getResultCode().name()))
            .setAbstractMessage(abstractMessage).build();

        final AbstractTransactionResponseProto abstractTransactionRequestProto = AbstractTransactionResponseProto
            .newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(
                TransactionExceptionCodeProto.valueOf(globalBeginResponse.getTransactionExceptionCode().name()))
            .build();

        final String extraData = globalBeginResponse.getExtraData();
        GlobalBeginResponseProto result = GlobalBeginResponseProto.newBuilder().setAbstractTransactionResponse(
            abstractTransactionRequestProto).setExtraData(extraData == null ? "" : extraData).setXid(
            globalBeginResponse.getXid()).build();
        return result;
    }
@Test
    public void convert2Proto() {

        GlobalBeginResponse globalBeginResponse = new GlobalBeginResponse();

        globalBeginResponse.setResultCode(ResultCode.Failed);
        globalBeginResponse.setMsg("msg");
        globalBeginResponse.setExtraData("extraData");
        globalBeginResponse.setXid("xid");
        globalBeginResponse.setTransactionExceptionCode(TransactionExceptionCode.BranchRollbackFailed_Retriable);

        GlobalBeginResponseConvertor convertor = new GlobalBeginResponseConvertor();
        GlobalBeginResponseProto proto = convertor.convert2Proto(globalBeginResponse);
        GlobalBeginResponse real = convertor.convert2Model(proto);
        assertThat((real.getTypeCode())).isEqualTo(globalBeginResponse.getTypeCode());
        assertThat((real.getMsg())).isEqualTo(globalBeginResponse.getMsg());
        assertThat((real.getResultCode())).isEqualTo(globalBeginResponse.getResultCode());
        assertThat((real.getTransactionExceptionCode())).isEqualTo(globalBeginResponse.getTransactionExceptionCode());
    }