On Wed, Jun 17, 2009 at 1:46 AM, David C. Hicks<dhi...@i-hicks.org> wrote:
>
> Barrie Treloar wrote:
>> I think I see what you are saying.
>>
>> Model (test) depends upon Test Support (main and test jars)
>> I am going to assume that Test Support does not depend upon Model
>> (either main or test)
>>
> Almost, but not quite.  TestSupport does depend on Model, because it
> includes the Builder classes that create Model objects for unit and
> functional tests.  It just works out that some of the more complex unit
> tests for Model classes *also* use the builders.  So, Model must be
> built before TestSupport, and TestSupport depends on Model.  I just have
> these few unit tests that really belong in the Model module but are
> currently in the TestSupport module because of their dependencies on the
> builders.
>
> I've only been able to see a few ways out of this:
>
> 1) Move business logic out of the Model and into some intermediate
> module.  (This moves me away from an OO paradigm. IMO)
> 2) Rewrite my Model unit tests so that they don't use builders. (This
> makes the tests less readable/maintainable.)
> 3) Create a new module that is nothing more than just the unit tests on
> the Model module.  Then dependencies can be resolved pretty easily.
> 4) Keep it as I have it now, with a few "special" Model unit tests
> living in the TestSupport module.  (I don't like this.  I think it will
> cause confusion in the future.)
>
> I just figured that I couldn't possibly be the first person to run into
> this problem.  So, I was curious how others resolved it.

You have a cyclic dependency.
The solution is to break the cycle.
There isn't another way.

Your choices on breaking it are:
* Move TestSupport into Model (not ideal)
* Move the code in Model that TestSupport relies upon into its own module.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to