Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency prescription and proscription #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tomvandenberge
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant