### Question:
RegisterRMResponseConvertor implements PbConvertor<RegisterRMResponse, RegisterRMResponseProto> { @Override public RegisterRMResponseProto convert2Proto(RegisterRMResponse registerRMResponse) { final short typeCode = registerRMResponse.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final String msg = registerRMResponse.getMsg(); if (registerRMResponse.getResultCode() == null) { if (registerRMResponse.isIdentified()) { registerRMResponse.setResultCode(ResultCode.Success); } else { registerRMResponse.setResultCode(ResultCode.Failed); } } final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg( msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(registerRMResponse.getResultCode().name())) .setAbstractMessage(abstractMessage).build(); final String extraData = registerRMResponse.getExtraData(); AbstractIdentifyResponseProto abstractIdentifyResponseProto = AbstractIdentifyResponseProto.newBuilder() .setAbstractResultMessage(abstractResultMessageProto).setExtraData(extraData == null ? "" : extraData) .setVersion(registerRMResponse.getVersion()).setIdentified(registerRMResponse.isIdentified()).build(); RegisterRMResponseProto result = RegisterRMResponseProto.newBuilder().setAbstractIdentifyResponse( abstractIdentifyResponseProto).build(); return result; }  @Override RegisterRMResponseProto convert2Proto(RegisterRMResponse registerRMResponse); @Override RegisterRMResponse convert2Model(RegisterRMResponseProto registerRMResponseProto);  }### Answer:
@Test public void convert2Proto() { RegisterRMResponse registerRMResponse = new RegisterRMResponse(); registerRMResponse.setResultCode(ResultCode.Failed); registerRMResponse.setMsg("msg"); registerRMResponse.setIdentified(true); registerRMResponse.setVersion("11"); registerRMResponse.setExtraData("extraData"); RegisterRMResponseConvertor convertor = new RegisterRMResponseConvertor(); RegisterRMResponseProto proto = convertor.convert2Proto(registerRMResponse); RegisterRMResponse real = convertor.convert2Model(proto); assertThat((real.getTypeCode())).isEqualTo(registerRMResponse.getTypeCode()); assertThat((real.getMsg())).isEqualTo(registerRMResponse.getMsg()); assertThat((real.getResultCode())).isEqualTo(registerRMResponse.getResultCode()); assertThat((real.isIdentified())).isEqualTo(registerRMResponse.isIdentified()); assertThat((real.getVersion())).isEqualTo(registerRMResponse.getVersion()); assertThat((real.getExtraData())).isEqualTo(registerRMResponse.getExtraData()); }