@Test
public void shouldReturnSnapshotsInDescendingTimestampOrder() throws InterruptedException, StorageException, IOException {

    // create a large number of snapshots
    int numSnapshots = 20;
    createSnapshots(numSnapshots);
    // check that they're there in the database
    List<SnapshotMetadata> snapshots = snapshotsStore.getAllSnapshotsFromLatestToOldest();
    assertThat(snapshots, hasSize(numSnapshots));
    // check there there are indeed those snapshots on the filesystem
    checkSnapshotsExistOnFilesystem(snapshots);
    // now, let's loop through and see if they're ordered correctly
    long prevTimestamp = Long.MAX_VALUE;
    for (SnapshotMetadata metadata : snapshots) {
        assertThat(prevTimestamp, greaterThan(metadata.getTimestamp()));
        prevTimestamp = metadata.getTimestamp();
    }
}