Repository: apache/dubbo-go-hessian2
Pull request #278 (2021-09-13 06:23:15)

feat(*): support wrapper classes for Java basic types
<!--  Thanks for sending a pull request! 
-->

**What this PR does**:

**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #

**Special notes for your reviewer**:

**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->
```release-note

```


Patch:
diff --git a/CHANGE.md b/CHANGE.md
index 2e642a3..8147c00 100644
--- a/CHANGE.md
+++ b/CHANGE.md
@@ -1,15 +1,5 @@
 # Release Notes
 
-## v1.9.3
-
-### New Features
-- add new api `Encoder.ReuseBufferClean()`. [#271](https://github.com/apache/dubbo-go-hessian2/pull/271)
-
-### Bugfixes
-- fix not unpack ref holder for list. [#269](https://github.com/apache/dubbo-go-hessian2/pull/269)
-- fix encode null for empty map, add map tag instead. [#275](https://github.com/apache/dubbo-go-hessian2/pull/275)
-- Fix getArgType reflection value logic. [#276](https://github.com/apache/dubbo-go-hessian2/pull/276)
-
 ## v1.9.2
 
 ### New Features
diff --git a/array.go b/array.go
new file mode 100644
index 0000000..1376a7a
--- /dev/null
+++ b/array.go
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package hessian
+
+import (
+	"strings"
+)
+
+func init() {
+	SetCollectionSerialize(&IntegerArray{})
+	SetCollectionSerialize(&ByteArray{})
+	SetCollectionSerialize(&ShortArray{})
+	SetCollectionSerialize(&BooleanArray{})
+	SetCollectionSerialize(&LongArray{})
+	SetCollectionSerialize(&FloatArray{})
+	SetCollectionSerialize(&DoubleArray{})
+	SetCollectionSerialize(&CharacterArray{})
+}
+
+// BooleanArray Boolean[]
+type BooleanArray struct {
+	Values []bool
+}
+
+// nolint
+func (ba *BooleanArray) Get() []interface{} {
+	res := make([]interface{}, len(ba.Values))
+	for i, v := range ba.Values {
+		res[i] = v
+	}
+	return res
+}
+
+// nolint
+func (ba *BooleanArray) Set(vs []interface{}) {
+	values := make([]bool, len(vs))
+	for i, v := range vs {
+		values[i] = v.(bool)
+	}
+	ba.Values = values
+}
+
+// nolint
+func (*BooleanArray) JavaClassName() string {
+	return "[java.lang.Boolean"
+}
+
+//IntegerArray Integer[]
+type IntegerArray struct {
+	Values []int32
+}
+
+// nolint
+func (ia *IntegerArray) Get() []interface{} {
+	res := make([]interface{}, len(ia.Values))
+	for i, v := range ia.Values {
+		res[i] = v
+	}
+	return res
+}
+
+// nolint
+func (ia *IntegerArray) Set(vs []interface{}) {
+	values := make([]int32, len(vs))
+	for i, v := range vs {
+		values[i] = v.(int32)
+	}
+	ia.Values = values
+}
+
+// nolint
+func (*IntegerArray) JavaClassName() string {
+	return "[java.lang.Integer"
+}
+
+// ByteArray Byte[]
+type ByteArray struct {
+	Values []uint8
+}
+
+// nolint
+func (ba *ByteArray) Get() []interface{} {
+	res := make([]interface{}, len(ba.Values))
+	for i, v := range ba.Values {
+		res[i] = v
+	}
+	return res
+}
+
+// nolint
+func (ba *ByteArray) Set(vs []interface{}) {
+	values := make([]uint8, len(vs))
+	for i, v := range vs {
+		values[i] = uint8(v.(int32))
+	}
+	ba.Values = values
+}
+
+// nolint
+func (*ByteArray) JavaClassName() string {
+	return "[java.lang.Byte"
+}
+
+// ShortArray Short[]
+type ShortArray struct {
+	Values []int16
+}
+
+// nolint
+func (sa *ShortArray) Get() []interface{} {
+	res := make([]interface{}, len(sa.Values))
+	for i, v := range sa.Values {
+		res[i] = v
+	}
+	return res
+}
+
+// nolint
+func (sa *ShortArray) Set(vs []interface{}) {
+	values := make([]int16, len(vs))
+	for i, v := range vs {
+		values[i] = int16(v.(int32))
+	}
+	sa.Values = values
+}
+
+// nolint
+func (*ShortArray) JavaClassName() string {
+	return "[java.lang.Short"
+}
+
+// LongArray Long[]
+type LongArray struct {
+	Values []int64
+}
+
+// nolint
+func (ba *LongArray) Get() []interface{} {
+	res := make([]interface{}, len(ba.Values))
+	for i, v := range ba.Values {
+		res[i] = v
+	}
+	return res
+}
+
+// nolint
+func (ba *LongArray) Set(vs []interface{}) {
+	values := make([]int64, len(vs))
+	for i, v := range vs {
+		values[i] = v.(int64)
+	}
+	ba.Values = values
+}
+
+// nolint
+func (*LongArray) JavaClassName() string {
+	return "[java.lang.Long"
+}
+
+// FloatArray Float[]
+type FloatArray struct {
+	Values []float32
+}
+
+// nolint
+func (fa *FloatArray) Get() []interface{} {
+	res := make([]interface{}, len(fa.Values))
+	for i, v := range fa.Values {
+		res[i] = v
+	}
+	return res
+}
+
+// nolint
+func (fa *FloatArray) Set(vs []interface{}) {
+	values := make([]float32, len(vs))
+	for i, v := range vs {
+		values[i] = float32(v.(float64))
+	}
+	fa.Values = values
+}
+
+// nolint
+func (*FloatArray) JavaClassName() string {
+	return "[java.lang.Float"
+}
+
+// DoubleArray Double[]
+type DoubleArray struct {
+	Values []float64
+}
+
+// nolint
+func (da *DoubleArray) Get() []interface{} {
+	res := make([]interface{}, len(da.Values))
+	for i, v := range da.Values {
+		res[i] = v
+	}
+	return res
+}
+
+// nolint
+func (da *DoubleArray) Set(vs []interface{}) {
+	values := make([]float64, len(vs))
+	for i, v := range vs {
+		values[i] = v.(float64)
+	}
+	da.Values = values
+}
+
+// nolint
+func (*DoubleArray) JavaClassName() string {
+	return "[java.lang.Double"
+}
+
+// CharacterArray Character[]
+type CharacterArray struct {
+	Values string
+}
+
+// nolint
+func (ca *CharacterArray) Get() []interface{} {
+	length := len(ca.Values)
+	charArr := strings.Split(ca.Values, "")
+	res := make([]interface{}, length)
+	for i := 0; i < length; i++ {
+		res[i] = charArr[i]
+	}
+	return res
+}
+
+// nolint
+func (ca *CharacterArray) Set(vs []interface{}) {
+	for _, v := range vs {
+		ca.Values = ca.Values + v.(string)
+	}
+}
+
+// nolint
+func (*CharacterArray) JavaClassName() string {
+	return "[java.lang.Character"
+}
diff --git a/output/output.go b/output/output.go
index f619a1a..a27afe0 100644
--- a/output/output.go
+++ b/output/output.go
@@ -42,6 +42,14 @@ func init() {
 	funcMap["JavaException"] = testfuncs.JavaException
 	funcMap["UserArray"] = testfuncs.UserArray
 	funcMap["UserList"] = testfuncs.UserList
+	funcMap["ByteArray"] = testfuncs.ByteArray
+	funcMap["ShortArray"] = testfuncs.ShortArray
+	funcMap["IntegerArray"] = testfuncs.IntegerArray
+	funcMap["LongArray"] = testfuncs.LongArray
+	funcMap["BooleanArray"] = testfuncs.BooleanArray
+	funcMap["CharacterArray"] = testfuncs.CharacterArray
+	funcMap["FloatArray"] = testfuncs.FloatArray
+	funcMap["DoubleArray"] = testfuncs.DoubleArray
 }
 
 func main() {
diff --git a/request.go b/request.go
index 7a50465..6d0b9ee 100644
--- a/request.go
+++ b/request.go
@@ -103,7 +103,7 @@ func getArgType(v interface{}) string {
 	default:
 		t := reflect.TypeOf(v)
 		if reflect.Ptr == t.Kind() {
-			t = t.Elem()
+			t = reflect.TypeOf(reflect.ValueOf(v).Elem())
 		}
 		switch t.Kind() {
 		case reflect.Struct:


Test patch:
diff --git a/array_test.go b/array_test.go
new file mode 100644
index 0000000..f53256f
--- /dev/null
+++ b/array_test.go
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package hessian
+
+import (
+	"github.com/stretchr/testify/assert"
+	"testing"
+)
+
+func TestBooleanArray(t *testing.T) {
+	booleanArray := &BooleanArray{[]bool{true, false}}
+	e := &Encoder{}
+	a := assert.New(t)
+
+	err := e.Encode(booleanArray)
+	a.Nil(err)
+
+	decoder := NewDecoder(e.buffer)
+	decodeValue, err := decoder.DecodeValue()
+	a.Nil(err)
+	a.Equal(booleanArray.Values, decodeValue.(*BooleanArray).Values)
+}
+
+func TestIntegerArray(t *testing.T) {
+	ia := &IntegerArray{[]int32{1, 2, 3}}
+	a := assert.New(t)
+
+	e := &Encoder{}
+	err := e.Encode(ia)
+	a.Nil(err)
+
+	decoder := NewDecoder(e.buffer)
+	decodeValue, err := decoder.DecodeValue()
+	a.Nil(err)
+	a.Equal(ia.Values, decodeValue.(*IntegerArray).Values)
+
+	// Integer[] that length > 7
+	bigIa := &IntegerArray{[]int32{1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3}}
+	ne := &Encoder{}
+	err = ne.Encode(bigIa)
+	a.Nil(err)
+
+	decoder = NewDecoder(e.buffer)
+	decodeValue, err = decoder.DecodeValue()
+	a.Nil(err)
+	a.Equal(ia.Values, decodeValue.(*IntegerArray).Values)
+}
+
+func TestByteArray(t *testing.T) {
+	ba := &ByteArray{}
+	ba.Values = []uint8{1, 2, 3}
+	a := assert.New(t)
+
+	e := &Encoder{}
+	err := e.Encode(ba)
+	a.Nil(err)
+
+	decoder := NewDecoder(e.buffer)
+	decodeValue, err := decoder.DecodeValue()
+	a.Nil(err)
+	a.Equal(ba.Values, decodeValue.(*ByteArray).Values)
+}
+
+func TestShortArray(t *testing.T) {
+	sa := &ShortArray{}
+	sa.Values = []int16{1, 2, 3}
+	a := assert.New(t)
+
+	e := &Encoder{}
+	err := e.Encode(sa)
+	a.Nil(err)
+
+	decoder := NewDecoder(e.buffer)
+	decodeValue, err := decoder.DecodeValue()
+	a.Nil(err)
+	a.Equal(sa.Values, decodeValue.(*ShortArray).Values)
+}
+
+func TestLongArray(t *testing.T) {
+	la := &LongArray{[]int64{1, 2, 3, 4}}
+	a := assert.New(t)
+
+	e := &Encoder{}
+	err := e.Encode(la)
+	a.Nil(err)
+
+	decoder := NewDecoder(e.buffer)
+	decodeValue, err := decoder.DecodeValue()
+	a.Nil(err)
+	a.Equal(la.Values, decodeValue.(*LongArray).Values)
+}
+
+func TestFloatArray(t *testing.T) {
+	fa := &FloatArray{[]float32{1, 2, 3, 4}}
+	a := assert.New(t)
+
+	e := &Encoder{}
+	err := e.Encode(fa)
+	a.Nil(err)
+
+	decoder := NewDecoder(e.buffer)
+	decodeValue, err := decoder.DecodeValue()
+	a.Nil(err)
+	a.Equal(fa.Values, decodeValue.(*FloatArray).Values)
+}
+
+func TestDoubleArray(t *testing.T) {
+	da := &DoubleArray{[]float64{1, 2, 3, 4}}
+	a := assert.New(t)
+
+	e := &Encoder{}
+	err := e.Encode(da)
+	a.Nil(err)
+
+	decoder := NewDecoder(e.buffer)
+	decodeValue, err := decoder.DecodeValue()
+	a.Nil(err)
+	a.Equal(da.Values, decodeValue.(*DoubleArray).Values)
+}
+
+func TestCharacterArray(t *testing.T) {
+	ca := &CharacterArray{"hello world"}
+	a := assert.New(t)
+
+	e := &Encoder{}
+	err := e.Encode(ca)
+	a.Nil(err)
+
+	decoder := NewDecoder(e.buffer)
+	decodeValue, err := decoder.DecodeValue()
+	a.Nil(err)
+	a.Equal(ca.Values, decodeValue.(*CharacterArray).Values)
+}
diff --git a/object_test.go b/object_test.go
index e5b51f1..f2d1e4f 100644
--- a/object_test.go
+++ b/object_test.go
@@ -847,3 +847,53 @@ func TestCustomReplyGenericResponseList(t *testing.T) {
 		assert.True(t, reflect.DeepEqual(data[1], list[1]))
 	})
 }
+
+func TestWrapperClassArray(t *testing.T) {
+	got, err := decodeJavaResponse(`byteArray`, `test.TestWrapperClassArray`, false)
+	assert.NoError(t, err)
+	t.Logf("%T %+v", got, got)
+	ba := &ByteArray{Values: []byte{byte(1), byte(100), byte(200)}}
+	assert.True(t, reflect.DeepEqual(got, ba))
+
+	got, err = decodeJavaResponse(`shortArray`, `test.TestWrapperClassArray`, false)
+	assert.NoError(t, err)
+	t.Logf("%T %+v", got, got)
+	sa := &ShortArray{Values: []int16{1, 100, 10000}}
+	assert.True(t, reflect.DeepEqual(got, sa))
+
+	got, err = decodeJavaResponse(`integerArray`, `test.TestWrapperClassArray`, false)
+	assert.NoError(t, err)
+	t.Logf("%T %+v", got, got)
+	ia := &IntegerArray{Values: []int32{1, 100, 10000}}
+	assert.True(t, reflect.DeepEqual(got, ia))
+
+	got, err = decodeJavaResponse(`longArray`, `test.TestWrapperClassArray`, false)
+	assert.NoError(t, err)
+	t.Logf("%T %+v", got, got)
+	la := &LongArray{Values: []int64{1, 100, 10000}}
+	assert.True(t, reflect.DeepEqual(got, la))
+
+	got, err = decodeJavaResponse(`characterArray`, `test.TestWrapperClassArray`, false)
+	assert.NoError(t, err)
+	t.Logf("%T %+v", got, got)
+	ca := &CharacterArray{Values: "hello world"}
+	assert.True(t, reflect.DeepEqual(got, ca))
+
+	got, err = decodeJavaResponse(`booleanArray`, `test.TestWrapperClassArray`, false)
+	assert.NoError(t, err)
+	t.Logf("%T %+v", got, got)
+	bla := &BooleanArray{Values: []bool{true, false, true}}
+	assert.True(t, reflect.DeepEqual(got, bla))
+
+	got, err = decodeJavaResponse(`floatArray`, `test.TestWrapperClassArray`, false)
+	assert.NoError(t, err)
+	t.Logf("%T %+v", got, got)
+	fa := &FloatArray{Values: []float32{1.0, 100.0, 10000.1}}
+	assert.True(t, reflect.DeepEqual(got, fa))
+
+	got, err = decodeJavaResponse(`doubleArray`, `test.TestWrapperClassArray`, false)
+	assert.NoError(t, err)
+	t.Logf("%T %+v", got, got)
+	da := &DoubleArray{Values: []float64{1.0, 100.0, 10000.1}}
+	assert.True(t, reflect.DeepEqual(got, da))
+}
diff --git a/output/testfuncs/wrapper_class_array.go b/output/testfuncs/wrapper_class_array.go
new file mode 100644
index 0000000..a3cd398
--- /dev/null
+++ b/output/testfuncs/wrapper_class_array.go
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package testfuncs
+
+import (
+	hessian "github.com/apache/dubbo-go-hessian2"
+)
+
+// nolint
+func ByteArray() []byte {
+	e := hessian.NewEncoder()
+	ba := &hessian.ByteArray{Values: []byte{byte(1), byte(100), byte(200)}}
+	e.Encode(ba)
+	return e.Buffer()
+}
+
+// nolint
+func ShortArray() []byte {
+	e := hessian.NewEncoder()
+	sa := &hessian.ShortArray{Values: []int16{1, 100, 10000}}
+	e.Encode(sa)
+	return e.Buffer()
+}
+
+// nolint
+func IntegerArray() []byte {
+	e := hessian.NewEncoder()
+	ia := &hessian.IntegerArray{Values: []int32{1, 100, 10000}}
+	e.Encode(ia)
+	return e.Buffer()
+}
+
+// nolint
+func LongArray() []byte {
+	e := hessian.NewEncoder()
+	la := &hessian.LongArray{Values: []int64{1, 100, 10000}}
+	e.Encode(la)
+	return e.Buffer()
+}
+
+// nolint
+func BooleanArray() []byte {
+	e := hessian.NewEncoder()
+	ba := &hessian.BooleanArray{Values: []bool{true, false, true}}
+	e.Encode(ba)
+	return e.Buffer()
+}
+
+// nolint
+func CharacterArray() []byte {
+	e := hessian.NewEncoder()
+	ca := &hessian.CharacterArray{Values: "hello world"}
+	e.Encode(ca)
+	return e.Buffer()
+}
+
+// nolint
+func FloatArray() []byte {
+	e := hessian.NewEncoder()
+	fa := &hessian.FloatArray{Values: []float32{1.0, 100.0, 10000.1}}
+	e.Encode(fa)
+	return e.Buffer()
+}
+
+// nolint
+func DoubleArray() []byte {
+	e := hessian.NewEncoder()
+	da := &hessian.DoubleArray{Values: []float64{1.0, 100.0, 10000.1}}
+	e.Encode(da)
+	return e.Buffer()
+}
diff --git a/test_hessian/src/main/java/test/TestWrapperClassArray.java b/test_hessian/src/main/java/test/TestWrapperClassArray.java
new file mode 100644
index 0000000..2185994
--- /dev/null
+++ b/test_hessian/src/main/java/test/TestWrapperClassArray.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package test;
+
+public class TestWrapperClassArray {
+
+    public static Byte[] byteArray() {
+        return new Byte[]{1, 100, -56};
+    }
+
+    public static Short[] shortArray() {
+        return new Short[]{1, 100, 10000};
+    }
+
+    public static Integer[] integerArray() {
+        return new Integer[]{1, 100, 10000};
+    }
+
+    public static Long[] longArray() {
+        return new Long[]{1L, 100L, 10000L};
+    }
+
+    public static Boolean[] booleanArray() {
+        return new Boolean[]{true, false, true};
+    }
+
+    public static Float[] floatArray() {
+        return new Float[]{1.0f, 100.0f, 10000.1f};
+    }
+
+    public static Double[] doubleArray() {
+        return new Double[]{1.0, 100.0, 10000.1};
+    }
+
+    public static Character[] characterArray() {
+        return new Character[]{'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'};
+    }
+}
diff --git a/test_hessian/src/test/java/unit/GoWrapperClassArrayTest.java b/test_hessian/src/test/java/unit/GoWrapperClassArrayTest.java
new file mode 100644
index 0000000..ae6ebcd
--- /dev/null
+++ b/test_hessian/src/test/java/unit/GoWrapperClassArrayTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package unit;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class GoWrapperClassArrayTest {
+
+    @Test
+    public void test() {
+        Assert.assertArrayEquals(new Byte[]{1, 100, -56}
+                , (Byte[])GoTestUtil.readGoObject("ByteArray"));
+        Assert.assertArrayEquals(new Short[]{1, 100, 10000}
+                , (Short[])GoTestUtil.readGoObject("ShortArray"));
+        Assert.assertArrayEquals(new Integer[]{1, 100, 10000}
+                , (Integer[])GoTestUtil.readGoObject("IntegerArray"));
+        Assert.assertArrayEquals(new Long[]{1L, 100L, 10000L}
+                , (Long[])GoTestUtil.readGoObject("LongArray"));
+        Assert.assertArrayEquals(new Boolean[]{true, false, true}
+                , (Boolean[])GoTestUtil.readGoObject("BooleanArray"));
+        Assert.assertArrayEquals(new Float[]{1.0f, 100.0f, 10000.1f}
+                , (Float[])GoTestUtil.readGoObject("FloatArray"));
+        Assert.assertArrayEquals(new Double[]{1.0, 100.0, 10000.1}
+                , (Double[])GoTestUtil.readGoObject("DoubleArray"));
+        Assert.assertArrayEquals(new Character[]{'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'}
+                , (Character[])GoTestUtil.readGoObject("CharacterArray"));
+    }
+}