This is an automated email from the ASF dual-hosted git repository.
Alanxtl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/develop by this push:
new 8e96ea3de test(hessian2): cover pointer long response fields (#3382)
8e96ea3de is described below
commit 8e96ea3de33a3a8dddbf70f4293cdd6eeca41421
Author: 吴杨帆 <[email protected]>
AuthorDate: Tue Jun 9 10:26:09 2026 +0800
test(hessian2): cover pointer long response fields (#3382)
Co-authored-by: wuyangfan <[email protected]>
---
protocol/dubbo/hessian2/hessian_dubbo_test.go | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/protocol/dubbo/hessian2/hessian_dubbo_test.go
b/protocol/dubbo/hessian2/hessian_dubbo_test.go
index 55177caec..e1628343b 100644
--- a/protocol/dubbo/hessian2/hessian_dubbo_test.go
+++ b/protocol/dubbo/hessian2/hessian_dubbo_test.go
@@ -48,10 +48,18 @@ type CaseB struct {
B CaseA
}
+type PointerLongResp struct {
+ Total *int64
+}
+
func (c *CaseB) JavaClassName() string {
return "com.test.caseb"
}
+func (p PointerLongResp) JavaClassName() string {
+ return "com.test.PointerLongResp"
+}
+
func (c CaseA) JavaClassName() string {
return "com.test.casea"
}
@@ -177,6 +185,20 @@ func TestResponse(t *testing.T) {
})
}
+func TestResponseWithPointerLongField(t *testing.T) {
+ total := int64(123456789)
+ body := &PointerLongResp{Total: &total}
+ decodedResponse := &DubboResponse{}
+ hessian.RegisterPOJO(body)
+
+ doTestResponse(t, PackageResponse, Response_OK, body, decodedResponse,
func() {
+ resp, ok := decodedResponse.RspObj.(*PointerLongResp)
+ require.True(t, ok)
+ require.NotNil(t, resp.Total)
+ assert.Equal(t, total, *resp.Total)
+ })
+}
+
func doTestRequest(t *testing.T, packageType PackageType, responseStatus byte,
body any) {
resp, err := doTestHessianEncodeHeader(t, packageType, responseStatus,
body)
require.NoError(t, err)