### Question:
GlobalRollbackRequestConvertor implements PbConvertor<GlobalRollbackRequest, GlobalRollbackRequestProto> { @Override public GlobalRollbackRequestProto convert2Proto(GlobalRollbackRequest globalRollbackRequest) { final short typeCode = globalRollbackRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage(abstractMessage).build(); final String extraData = globalRollbackRequest.getExtraData(); AbstractGlobalEndRequestProto abstractGlobalEndRequestProto = AbstractGlobalEndRequestProto.newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto).setXid(globalRollbackRequest.getXid()) .setExtraData(extraData == null ? "" : extraData).build(); GlobalRollbackRequestProto result = GlobalRollbackRequestProto.newBuilder().setAbstractGlobalEndRequest( abstractGlobalEndRequestProto).build(); return result; }  @Override GlobalRollbackRequestProto convert2Proto(GlobalRollbackRequest globalRollbackRequest); @Override GlobalRollbackRequest convert2Model(GlobalRollbackRequestProto globalRollbackRequestProto);  }### Answer:
@Test public void convert2Proto() { GlobalRollbackRequest globalRollbackRequest = new GlobalRollbackRequest(); globalRollbackRequest.setExtraData("extraData"); globalRollbackRequest.setXid("xid"); GlobalRollbackRequestConvertor convertor = new GlobalRollbackRequestConvertor(); GlobalRollbackRequestProto proto = convertor.convert2Proto( globalRollbackRequest); GlobalRollbackRequest real = convertor.convert2Model(proto); assertThat((real.getTypeCode())).isEqualTo(globalRollbackRequest.getTypeCode()); assertThat((real.getXid())).isEqualTo(globalRollbackRequest.getXid()); assertThat((real.getExtraData())).isEqualTo(globalRollbackRequest.getExtraData()); }