Open wustudent opened 3 months ago
The behavior that simply return an empty list is however still wrong, this is because: during the build stage of the scenario, when schematron is provided, schematron validation transformation should be added to the list of field schematronValidations. If we return an empty list but not assign it to the field, in the end all the schematrons will be ignored. Commit e5507b6 fixed this.
The code of v1.5.0 contains a bug which prevents building a scenario with schematron via the API:
In function Scenario.getSchematronValidations the function returns an empty list when there are no schematronValidations. But the return value
Collections.emptyList()
is an immutable list which can not perform add method. This getter will be called in ScenarioBuilder.buildSchematron with an add operation to add the build result, which leads to anUnsupportedOperationException
This pull request did the bug fix and add the test case for this case.