FxGsonTest.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:fx-gson 作者:
@Theory
public void testSetProperty(@FromDataPoints("all") Gson gson) {
    CustomObject one = new CustomObject("myObj1");
    CustomObject two = new CustomObject("myObj2");

    ObservableSet<CustomObject> setEmpty = FXCollections.emptyObservableSet();
    ObservableSet<CustomObject> setOne = FXCollections.observableSet(one);
    ObservableSet<CustomObject> setTwo = FXCollections.observableSet(one, two);

    testProperty(WithSetProp.class, null, "{\"prop\":null}", o -> o.prop, gson);
    testProperty(WithSetProp.class, setEmpty, "{\"prop\":[]}", o -> o.prop, gson);
    testProperty(WithSetProp.class, setOne, "{\"prop\":[{\"name\":\"myObj1\"}]}", o -> o.prop, gson);
    // do not check a particular JSON because the order is non-deterministic
    testProperty(WithSetProp.class, setTwo, null, o -> o.prop, gson);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号