Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.1.4.RELEASE
-
None
-
None
Description
I've been using DataOnDemand classes for some unit tests, specifically around creating Mocks to verify behavior of validations and other methods. This works fine, in isolation. However, if the DataOnDemand framework detects a reference to another entity, for example an Order entity under test holds a reference to a Product in a @ManyToOne, Roo will try to use the ProductDataOnDemand object to create it.
The implementation is fine in the integration test scenario. However, since Roo uses @Autowired to inject the referenced data on demand instance, it blows up during a unit test.
I would like one of two behaviors:
- new the referenced data-on-demand instance of the collaborator directly
- skip the initialization if the test does not see an injected collaborator
I prefer the first option, since it behaves predictably, and would cascade nicely.