### Question:
SyncService { List<Snapshot> calculateMissingSnapshots( Collection<Snapshot> sourceSnapshots, Set<SnapshotEntry> availableSnapshots) { List<Snapshot> result = new ArrayList<>(); HashSet<Integer> availableSnapshotNrs = new HashSet<>(); for (SnapshotEntry e : availableSnapshots) { availableSnapshotNrs.add(e.snapshotNr); } for (Snapshot s : sourceSnapshots) { if (!availableSnapshotNrs.contains(s.nr)) { result.add(s); } } return result; }  StreamState calculateStreamState(Stream stream, boolean isNew); List<SendFileSpec> determineSendFiles(Stream sourceStream,
            StreamState stateOfTarget);  }### Answer:
@Test public void testCalculateMissingSnapshots() throws Exception { ArrayList<Snapshot> snapshots = new ArrayList<>(); snapshots.add(new Snapshot(1, null, null)); Snapshot snapshot3 = new Snapshot(3, null, null); snapshots.add(snapshot3); Set<SnapshotEntry> snapshotNumbers = new HashSet<>(); snapshotNumbers.add(new SnapshotEntry(1, null)); snapshotNumbers.add(new SnapshotEntry(2, null)); List<Snapshot> missing = service.calculateMissingSnapshots(snapshots, snapshotNumbers); assertThat(missing, hasSize(1)); assertThat(missing, hasItem(snapshot3)); }