use of uk.gov.justice.domain.aggregate.NoSerializableTestAggregate in project microservice_framework by CJSCommonPlatform.
the class DefaultSnapshotServiceTest method shouldNotCreateSnapshotWhenStrategyMandatesCreationButFailsSerialization.
@Test
public void shouldNotCreateSnapshotWhenStrategyMandatesCreationButFailsSerialization() throws AggregateChangeDetectedException {
final NoSerializableTestAggregate aggregate = new NoSerializableTestAggregate();
final Long currentSnapshotVersion = 16l;
final Long currentAggregateVersionId = 36l;
when(snapshotRepository.getLatestSnapshotVersion(STREAM_ID, NoSerializableTestAggregate.class)).thenReturn(currentSnapshotVersion);
when(snapshotStrategy.shouldCreateSnapshot(currentAggregateVersionId, currentSnapshotVersion)).thenReturn(true);
snapshotService.attemptAggregateStore(STREAM_ID, currentAggregateVersionId, aggregate);
verify(snapshotRepository, never()).storeSnapshot(any(AggregateSnapshot.class));
}
Aggregations