I’m trying to use Enumeration Extension Methods from ReportingEngine with use of JsonDataSource (in JAVA language).
Unfortunately whatever I’m trying to use it always ends with error.
java.lang.NullPointerException: Cannot invoke “com.aspose.words.internal.zzVWh.zzXWJ(Object, String, com.aspose.words.internal.zzVSM[])” because “this.zzXYr” is null
I prepared sample test in JUnit 5:
@ParameterizedTest
@ValueSource(strings = {
"<<[test.activities.first()]>>",
"<<[test.activities.first().activities_Text]>>",
"<<[test.addresses.count()]>>",
"<<[test.addresses.Count()]>>",
"<<[test.addresses.city]>>",
"<<[test.addresses.first().city]>>",
})
void shouldPassWithoutErrorForJson(String expression) throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write(expression);
var reportingEngine = new ReportingEngine();
var data = new JsonDataSource(new ByteArrayInputStream(JSON_TEST_DATA.getBytes()));
reportingEngine.buildReport(doc, data, "test");
}
private static final String JSON_TEST_DATA = """
{
"name" : "David",
"activities" : [ "Cooking", "Computer Games" ],
"addresses" : [ {
"street" : "1st street",
"city" : "New Town"
},
{
"street" : "2st street",
"city" : "New City"
}
]
}
""";