Closed rweisleder closed 5 years ago
Hi Roland,
thank you very much for your pull request. I'll have to think about this a little. I don't quite like it, that it's an either-or solution. Either you choose the ConfigFileEnvironment or the SimpleEnvironment. SimpleEnvironment looses all the default settings from the project, which some users might easily overlook and might have bad consequences and makes things harder to handle. I would rather create a solution that delegates to the basic configuration. A mechanism that is supported by the config library. That way you would create an environment, that only contains the settings, that are relevant to you and all the rest is delegated to the base configuration. I think I will merge your solution into a branch and work from there...
Thanks for the feedback!
The SimpleEnvironment
is designed that the user only defines some/all/none of the properties. Therefore all fields of this class are nullable. If a property is not defined a fallback Environment
is used. The DefaultEnvironment
- the predefined fallback - contains the current default values.
Will this get merged? Without this, we can't use this lib for JUnit PDFs using different error margins.
Sorry it took so long!
I just release version 1.1.35, which includes this change. It should land in maven central during the next couple of hours. Thank you very much for your contribution to the project!
Before this commit the Environment was configured via config files, which had to be present at the classpath root or the working directory.
There are use cases in which users want to configure the Environment programmatically or want to reconfigure the Environment during runtime. Example: to set a different "allowed difference" in various runs. This would only have been possible by writing a config file and let pdfcompare parse that config file again.
Now it is possible to call
The default interface implementations are ConfigFileEnvironment (which parses a HOCON file) and SimpleEnvironment (with simple setter methods).
If no Environment is provided, the old mechanism is used as fallback.
Resolves #32