Storage { public synchronized LongStream complement(final Set<Long> investmentIds) { return originalContents.stream() .filter(i -> !investmentIds.contains(i)) .mapToLong(i -> i); } Storage(final Tenant tenant, final String key); synchronized boolean isKnown(final long investmentId); synchronized boolean add(final long investmentId); synchronized boolean remove(final long investmentId); synchronized void persist(); synchronized LongStream complement(final Set<Long> investmentIds);  }
@Test void complementsWhenEmpty() { final long id = 1; final Storage s = new Storage(tenant, UUID.randomUUID() .toString()); assertThat(s.complement(Collections.emptySet())).isEmpty(); assertThat(s.complement(Collections.singleton(id))).isEmpty(); }