Search in sources :

Example 1 with NoSerializableTestAggregate

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));
}
Also used : NoSerializableTestAggregate(uk.gov.justice.domain.aggregate.NoSerializableTestAggregate) AggregateSnapshot(uk.gov.justice.domain.snapshot.AggregateSnapshot) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 NoSerializableTestAggregate (uk.gov.justice.domain.aggregate.NoSerializableTestAggregate)1 AggregateSnapshot (uk.gov.justice.domain.snapshot.AggregateSnapshot)1