SofaResponse implements Serializable { public Object getResponseProp(String key) { return responseProps == null ? null : responseProps.get(key); }  Object getAppResponse(); void setAppResponse(Object response); boolean isError(); String getErrorMsg(); void setErrorMsg(String error); Object getResponseProp(String key); void addResponseProp(String key, String value); void removeResponseProp(String key); Map<String, String> getResponseProps(); void setResponseProps(Map<String, String> responseProps); byte getSerializeType(); SofaResponse setSerializeType(byte serializeType); AbstractByteBuf getData(); SofaResponse setData(AbstractByteBuf data); @Override String toString();  }
@Test public void getResponseProp() { SofaResponse response = new SofaResponse(); response.setErrorMsg(null); Assert.assertFalse(response.isError()); response = new SofaResponse(); response.setErrorMsg("1233"); Assert.assertTrue(response.isError()); Assert.assertEquals("1233", response.getErrorMsg()); response = new SofaResponse(); response.setAppResponse(new RuntimeException("1233")); Assert.assertTrue(response.getAppResponse() instanceof RuntimeException); Assert.assertFalse(response.isError()); response = new SofaResponse(); response.setAppResponse("1233"); Assert.assertFalse(response.isError()); Assert.assertEquals("1233", response.getAppResponse()); response.setSerializeType((byte) 11); response.setData(new ByteArrayWrapperByteBuf(new byte[] { 1, 2, 3 })); Assert.assertTrue(response.getSerializeType() == 11); Assert.assertTrue(response.getData().array().length == 3); Map<String, String> map = response.getResponseProps(); Assert.assertTrue(map == null); response.addResponseProp("1", "1"); map = response.getResponseProps(); Assert.assertTrue(map.size() == 1); response.addResponseProp(null, "1"); Assert.assertTrue(map.size() == 1); response.addResponseProp("1", null); Assert.assertTrue(map.size() == 1); response.removeResponseProp(null); Assert.assertTrue(map.size() == 1); response.removeResponseProp("1"); Assert.assertTrue(map.size() == 0); Assert.assertNull(response.getResponseProp("1")); response.setResponseProps(Collections.singletonMap("1", "1")); Assert.assertTrue(response.getResponseProps().size() == 1); }