@Theory
public void testMapIntProperty(@FromDataPoints("all") Gson gson) {
CustomObject one = new CustomObject("myObj1");
CustomObject two = new CustomObject("myObj2");
ObservableMap<Integer, CustomObject> mapEmpty = FXCollections.emptyObservableMap();
ObservableMap<Integer, CustomObject> mapOne = FXCollections.observableHashMap();
mapOne.put(1, one);
ObservableMap<Integer, CustomObject> mapTwo = FXCollections.observableHashMap();
mapTwo.put(1, one);
mapTwo.put(2, two);
testProperty(WithMapIntProp.class, null, "{\"prop\":null}", o -> o.prop, gson);
testProperty(WithMapIntProp.class, mapEmpty, "{\"prop\":{}}", o -> o.prop, gson);
testProperty(WithMapIntProp.class, mapOne, "{\"prop\":{\"1\":{\"name\":\"myObj1\"}}}", o -> o.prop, gson);
testProperty(WithMapIntProp.class, mapTwo,
"{\"prop\":{\"1\":{\"name\":\"myObj1\"},\"2\":{\"name\":\"myObj2\"}}}", o -> o.prop, gson);
}
FxGsonTest.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:fx-gson
作者:
评论列表
文章目录