Creating CalendarEntry Instances

Let’s look at the design. The Factory we are considering now has its site on Calendar and is used to create CalendarEntry instances. The CollabOvation team takes us through the implementation.

Image

Here’s a test developed to demonstrate how the Calendar Factory Method should be used:

public class CalendarTest extends DomainTest {     private CalendarEntry calendarEntry;     private CalendarEntryId calendarEntryId;     ...     public void testCreateCalendarEntry() throws Exception {         Calendar calendar = this.calendarFixture();         DomainRegistry.calendarRepository().add(calendar); ...

Get Implementing Domain-Driven Design now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.