clarkware/jdepend — pull request #4 by tomvandenberge (2013-05-16 07:22:26+00:00)
Title: Dependency prescription and proscription

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