Dependency prescription and proscription #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have made an extension to the API intended for unit testing.
The DependencyConstraint allows you to specify all expected dependencies between packages. If other dependencies than those specified are anaylized, the DependencyConstraint can tell you. This is a very useful feature, but for a larger codebase it can be a lot of work to specify all dependencies. In some situations it is sufficient to specify only the dependencies that you don't want. That's what I've added.
The DependencyConstraint defines all expected dependencies, and is therefore a prescription. Defining forbidden dependencies is a proscription. So I renamed DependencyConstraint to DependencyPrescription, and added a new DependencyProscription.
When you'd like to verify dependencies in a unit test, you can choose between the DependencyPrescription and DependencyProscription. Both classes now extend the abstract DependencyDirective, which specifies the method followsDirective() to check if the analyzed packages follow the directive (pre- or proscription).
To maintain backward compatibility, DependencyConstraint is still around, but is now only a delegate for DependencyPrescription.
I've taken the liberty of introducing generics in the codebase. I don't think this will hurt any pre-Java5 clients.
JavaDoc and unit tests are added too, obviously.
I hope you find this addition useful enough to pull it in your repository.
Thanks,
Tom