Q:

Ivy: using a common library for unit tests while avoiding circular dependencies

I have a few Ivy projects - let's call them A, B, C and D, that need a common base for unit tests. In order to reuse code I created a separate project Z just to hold this unit test common foundation and added it as a dependency to the various Ivy projects (I'm using JUnit by the way).
The problem is: project Z depends on some classes from the projects A and B. Result: circular dependency. Z depends on A and B for this "unit test foundation", and A and B depend on Z for the unit tests.
I understand circular dependency is undesirable. I get a warning every time I compile the code.
Any suggestions?

A:

The answer is very simple, but also quite difficult.
Move the things that depends on A or B out of Z and into A and B.
When this doesn't work move the things in A and B that Z depends on into Z.
Repeat.
You may discover that you have classes with mixed responsibilities that will need to be split apart so that concerns that ought to live in A/B/Z can be separated.
Tools exist that can help you visualise the dependencies, which might help.

