Skip to content

Commit

Permalink
add unit test(if map is pojo, write class name first)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengzepeng committed Jul 17, 2022
1 parent 31f2f96 commit 2437f11
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,15 @@ func TestCustomMap(t *testing.T) {

testDecodeFramework(t, "customReplyListMapListMap", listMapListMap)
}

type CustomMap map[string]interface{}

func (dict *CustomMap) JavaClassName() string {
return "test.model.CustomMap"
}

func TestJavaMap(t *testing.T) {
customMap := &CustomMap{"Name": "Test"}
RegisterPOJO(customMap)
testJavaDecode(t, "customArgTypedFixed_CustomMap", customMap)
}
9 changes: 9 additions & 0 deletions test_hessian/src/main/java/test/TestCustomDecode.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import com.caucho.hessian.io.Hessian2Input;
import com.caucho.hessian.test.A0;
import com.caucho.hessian.test.A1;

import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

import test.model.CustomMap;
import test.model.DateDemo;


Expand Down Expand Up @@ -214,4 +216,11 @@ public Object customArgTypedFixedList_HashSet() throws Exception {
HashSet o = (HashSet) input.readObject();
return o.contains(0) && o.contains(1);
}

public Object customArgTypedFixed_CustomMap() throws Exception {
CustomMap o = (CustomMap) input.readObject();
String value = (String) o.get("Name");
return "Test".equals(value);
}

}

0 comments on commit 2437f11

Please sign in to comment.