### Question:
GlobalLockQueryResponseConvertor implements PbConvertor<GlobalLockQueryResponse, GlobalLockQueryResponseProto> { @Override public GlobalLockQueryResponseProto convert2Proto(GlobalLockQueryResponse globalLockQueryResponse) { final short typeCode = globalLockQueryResponse.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final String msg = globalLockQueryResponse.getMsg(); final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg( msg == null ? "" : msg).setResultCode( ResultCodeProto.valueOf(globalLockQueryResponse.getResultCode().name())).setAbstractMessage(abstractMessage) .build(); AbstractTransactionResponseProto abstractTransactionResponseProto = AbstractTransactionResponseProto .newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode( TransactionExceptionCodeProto.valueOf(globalLockQueryResponse.getTransactionExceptionCode().name())) .build(); GlobalLockQueryResponseProto result = GlobalLockQueryResponseProto.newBuilder().setLockable( globalLockQueryResponse.isLockable()).setAbstractTransactionResponse(abstractTransactionResponseProto) .build(); return result; }  @Override GlobalLockQueryResponseProto convert2Proto(GlobalLockQueryResponse globalLockQueryResponse); @Override GlobalLockQueryResponse convert2Model(GlobalLockQueryResponseProto globalLockQueryResponseProto);  }### Answer:
@Test public void convert2Proto() { GlobalLockQueryResponse globalLockQueryResponse = new GlobalLockQueryResponse(); globalLockQueryResponse.setLockable(true); globalLockQueryResponse.setMsg("msg"); globalLockQueryResponse.setResultCode(ResultCode.Failed); globalLockQueryResponse.setTransactionExceptionCode(TransactionExceptionCode.GlobalTransactionNotActive); GlobalLockQueryResponseConvertor convertor = new GlobalLockQueryResponseConvertor(); GlobalLockQueryResponseProto proto = convertor.convert2Proto( globalLockQueryResponse); GlobalLockQueryResponse real = convertor.convert2Model(proto); assertThat((real.getTypeCode())).isEqualTo(globalLockQueryResponse.getTypeCode()); assertThat((real.getMsg())).isEqualTo(globalLockQueryResponse.getMsg()); assertThat((real.getResultCode())).isEqualTo(globalLockQueryResponse.getResultCode()); assertThat((real.getTransactionExceptionCode())).isEqualTo( globalLockQueryResponse.getTransactionExceptionCode()); }