### Question:
BranchReportRequestConvertor implements PbConvertor<BranchReportRequest, BranchReportRequestProto> { @Override public BranchReportRequestProto convert2Proto(BranchReportRequest branchReportRequest) { final short typeCode = branchReportRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage(abstractMessage).build(); final String applicationData = branchReportRequest.getApplicationData(); final String resourceId = branchReportRequest.getResourceId(); BranchReportRequestProto result = BranchReportRequestProto.newBuilder().setAbstractTransactionRequest( abstractTransactionRequestProto).setXid(branchReportRequest.getXid()).setBranchId( branchReportRequest.getBranchId()).setBranchType( BranchTypeProto.valueOf(branchReportRequest.getBranchType().name())).setApplicationData( applicationData == null ? "" : applicationData).setResourceId(resourceId == null ? "" : resourceId) .setStatus(BranchStatusProto.valueOf(branchReportRequest.getStatus().name())).build(); return result; }  @Override BranchReportRequestProto convert2Proto(BranchReportRequest branchReportRequest); @Override BranchReportRequest convert2Model(BranchReportRequestProto branchReportRequestProto);  }### Answer:
@Test public void convert2Proto() { BranchReportRequest branchReportRequest = new BranchReportRequest(); branchReportRequest.setApplicationData("data"); branchReportRequest.setBranchId(123); branchReportRequest.setResourceId("resourceId"); branchReportRequest.setXid("xid"); branchReportRequest.setBranchType( BranchType.AT); branchReportRequest.setStatus(BranchStatus.PhaseOne_Done); BranchReportRequestConvertor convertor = new BranchReportRequestConvertor(); BranchReportRequestProto proto = convertor.convert2Proto(branchReportRequest); BranchReportRequest real = convertor.convert2Model(proto); assertThat(real.getBranchType()).isEqualTo(branchReportRequest.getBranchType()); assertThat(real.getXid()).isEqualTo(branchReportRequest.getXid()); assertThat(real.getResourceId()).isEqualTo(branchReportRequest.getResourceId()); assertThat(real.getBranchId()).isEqualTo(branchReportRequest.getBranchId()); assertThat(real.getApplicationData()).isEqualTo(branchReportRequest.getApplicationData()); assertThat(real.getStatus()).isEqualTo(branchReportRequest.getStatus()); }