我正在为我的类做单元测试,我使用 PodamFactoryImpl 用虚拟数据填充对象。
问题:
似乎具有@NotEmpty(来自javax.validation.constraints)等注释的字段为NULL。
有什么方法可以配置 PodamFactoryImpl 实例来填充所有字段?(比如将其配置为忽略注释)
我的填充方法:
public static <T> T fillObject(Class<T> clazz) {
PodamFactory factory = new PodamFactoryImpl();
return factory.manufacturePojoWithFullData(clazz);
}
我可悲的例子 POJO:
public class Location {
@NotEmpty
private String tenant; //will be null
@NotEmpty
private String serviceName; //will be null
@NotNull
private List<LocationData> locations; //will be with value
@NotNull
private Boolean async; //will be with value
@NotNull
private Long companyIndex; //will be with value
@NotEmpty
private String topicId; //will also be null
}