Take the 2-minute tour ×  DDD recommends that the domain objects
should be in a valid state at any time. Aggregate roots are
responsible for guaranteeing the invariants and Factories for
assembling objects with all the required parts so that they are
initialized in a valid state.  However this seems to complicate
the task of creating simple, isolated unit tests a lot.  Let's
assume we have a BookRepository that contains Books. A Book has
:    • an Author   • a Category   • a list of Bookstores you can
find the book in  These are required attributes : a book has to
have an author, a category and at least a book store you can buy
the book from. There's likely to be a BookFactory since it is
quite a complex object, and the Factory will initialize the Book
with at least all the mentioned attributes. Maybe we'll also
make the Book constructor private (and the Factory nested) so
that no one can instantiate an empty Book except the Factory.
Now we want to unit test a method of the BookRepository that
returns all th