@Test(expected = IllegalStateException.class)
public void testGetSnapshotDoesNotExistInPersistenceProvider() {

    final BucketEntity existingBucket = createBucketEntity("b1");
    final FlowEntity existingFlow = createFlowEntity(existingBucket.getId());
    final FlowSnapshotEntity existingSnapshot = createFlowSnapshotEntity(existingFlow.getId());
    existingFlow.setSnapshotCount(10);
    when(metadataService.getBucketById(existingBucket.getId()))
            .thenReturn(existingBucket);
    when(metadataService.getFlowByIdWithSnapshotCounts(existingFlow.getId()))
            .thenReturn(existingFlow);
    when(metadataService.getFlowSnapshot(existingFlow.getId(), existingSnapshot.getVersion()))
            .thenReturn(existingSnapshot);
    when(flowPersistenceProvider.getFlowContent(
            existingBucket.getId(),
            existingSnapshot.getFlowId(),
            existingSnapshot.getVersion()
    )).thenReturn(null);
    registryService.getFlowSnapshot(existingBucket.getId(), existingSnapshot.getFlowId(), existingSnapshot.getVersion());
}