コード例 #1
0
 @Before
 public void setUp() {
   fixture = new AggregateTestFixture<>(StandardAggregate.class);
   fixture.setReportIllegalStateChange(false);
   mockAggregateFactory = mock(AggregateFactory.class);
   when(mockAggregateFactory.getAggregateType()).thenReturn(StandardAggregate.class);
   when(mockAggregateFactory.createAggregateRoot(isA(String.class), isA(DomainEventMessage.class)))
       .thenReturn(new StandardAggregate("id1"));
 }
コード例 #2
0
 @Test
 public void testFixtureDetectsStateChangeOutsideOfHandler_Ignored() {
   List<?> givenEvents =
       Arrays.asList(
           new MyEvent("aggregateId", 1),
           new MyEvent("aggregateId", 2),
           new MyEvent("aggregateId", 3));
   fixture.setReportIllegalStateChange(false);
   fixture
       .registerAnnotatedCommandHandler(
           new MyCommandHandler(fixture.getRepository(), fixture.getEventBus()))
       .given(givenEvents)
       .when(new IllegalStateChangeCommand("aggregateId", null));
 }