Here is the conundrum,
I have a fairly complex Value Object and I don't want to expose it's internals. It should not be an Entity since there is no need for attaching an identity to it. According to Eric Evans in his DDD Reference book it is Ok to use a Factory in order to create complex Value Objects:
Shift the responsibility for creating instances of complex objects and aggregates to a separate object, which may itself have no responsibility in the domain model but is still part of the domain design. Provide an interface that encapsulates all complex assembly and that does not require the client to reference the concrete classes of the objects being instantiated. Create an entire aggregate as a piece, enforcing its invariants. Create a complex value object as a piece, possibly after assembling the elements with a builder.
In order to constraint the construction process, the Value Object constructor is package private and the Factory resides in the same package as the Value Object. All other classes that represent the internals of the Value object are package private and reside in the same package. The Value Object is marked as final in order to guarantee immutability. This Value Object is being used by Services that reside in a different package.
The question is, how to write unit tests for the Services that depend on this Value Object without actually using the Factory in the unit tests?
The Value Object can't be mocked considering that it has no public constructor and is final. Any thoughts or suggestions?