formatter-maven-plugin
formatter-maven-plugin copied to clipboard
Add tests for the formatter mojo caching of files, one failing
Adding four unit tests for the FormatterMojo caching mechanism. One of the tests is failing, as a demonstration of #312. If preferred, I could make these new tests part of #313, which fixes the issue.
Please refer to the test's names for a summary description of what they do.
I've tried to minimize impact on existing code but testing Mojos is tricky, so I've made some properties package-scope in order to inject the required state without going trough a complete Plexus/Maven initialization.
I can't get any of these tests to pass. They all say File Not Found when I do a clean build.
I've found the problem and fixed it. Each test case now gets its own source file copy. One test still fails, demonstrating the case where the cache isn't updated.
We may want this test, not sure yet. Leaving this open. The overall issue though has been addressed on master.
I'm going to look at this to see what value as caching has been cleaned up rather well now. This may still be beneficial to have an extra test. Will either apply or decline this later tonight.
Given that caching has changed for the better since this PR was created, and there hasn't been any activity here in over a year, I'm closing this PR. If there is still a reason to apply a patch like this, please create a new PR based on the current state of the repo.
For grins as I have coveralls running on my fork which shows 40% coverage currently, I added this, adjusted to get it working again, then ran check again on coverage. It raised it 7%, so I've applied on my fork as that is a healthy improvement. Not sure I liked that it abused encapsulation to avoid reflection to get at internals of the original class but 7% considering 40% originally is pretty big deal. And of course it simply worked now since the caching changes actually fixed the failure automatically.