mtedone / podam

PODAM - POjo DAta Mocker
https://mtedone.github.io/podam
MIT License
326 stars 749 forks source link

manufacturePojoWithFullData issue with Instant #312

Closed jinqinghua closed 1 year ago

jinqinghua commented 1 year ago
public class Xxxx {
    private static final PodamFactory factory = new PodamFactoryImpl();

    public static void main(String[] args) {
        WebcastMedia media1 = factory.manufacturePojo(WebcastMedia.class);
        WebcastMedia media2 = factory.manufacturePojoWithFullData(WebcastMedia.class);
        System.out.printf("OK");
    }
}
jinqinghua commented 1 year ago
public class WebcastMedia implements Serializable {
    // ...
    private Instant appCreateTime;
    private Instant createTime;
    private Instant lastModifiedTime;
    //...
}
jinqinghua commented 1 year ago

media1's instant field is right, but media2's instant field is wrong.

daivanov commented 1 year ago

Hi,

Could you please describe, what specifically wrong in the created POJO? When you call manufacturePojo(Instant.class) Instant.now() is used. When you call manufacturePojoWithFullData(Instant.class) Instant.ofEpochSecond(epochSecond,nanoAdjustment) is used. Both of them succeed.

Thanks, Daniil

jinqinghua commented 1 year ago

media1: WebcastMedia(appCreateTime=2023-02-14T00:38:57.756884Z, createTime=2023-02-14T00:38:57.754318Z, lastModifiedTime=2023-02-14T00:38:57.755576Z)

media2: WebcastMedia(appCreateTime=+3379484-06-13T05:05:54.061497703Z, createTime=+3379484-04-20T18:38:12.057097929Z, lastModifiedTime=+3379484-05-19T06:17:49.059412336Z)

@daivanov Sorry for the late response. Could you please check the year part of media2?