@Theory
public void testCustomTreeMapStrProperty(@FromDataPoints("all") Gson gson) {
CustomObject one = new CustomObject("myObj1");
CustomObject two = new CustomObject("myObj2");
Map<String, CustomObject> mapEmpty = new TreeMap<>();
Map<String, CustomObject> mapOne = new TreeMap<>();
mapOne.put("key1", one);
Map<String, CustomObject> mapTwo = new TreeMap<>();
mapTwo.put("key1", one);
mapTwo.put("key2", two);
ObservableMap<String, CustomObject> mapEmptyObs = FXCollections.observableMap(mapEmpty);
ObservableMap<String, CustomObject> mapOneObs = FXCollections.observableMap(mapOne);
ObservableMap<String, CustomObject> mapTwoObs = FXCollections.observableMap(mapTwo);
testProperty(WithMapStrProp.class, null, "{\"prop\":null}", o -> o.prop, gson);
testProperty(WithMapStrProp.class, mapEmptyObs, "{\"prop\":{}}", o -> o.prop, gson);
testProperty(WithMapStrProp.class, mapOneObs, "{\"prop\":{\"key1\":{\"name\":\"myObj1\"}}}", o -> o.prop, gson);
testProperty(WithMapStrProp.class, mapTwoObs,
"{\"prop\":{\"key1\":{\"name\":\"myObj1\"},\"key2\":{\"name\":\"myObj2\"}}}", o -> o.prop, gson);
}
FxGsonTest.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:fx-gson
作者:
评论列表
文章目录