AbstractSubscriptions implements Subscriptions<T> { @Override public SubscriptionsReader snapshot() { return SubscriptionsReader.of(exportTopicData(), exportSubscriberToFilter()); } protected  AbstractSubscriptions(
            final Map<ActorRef, Set<String>> subscriberToTopic,
            final Map<ActorRef, Predicate<Collection<String>>> subscriberToFilter,
            final Map<String, TopicData<H>> topicToData); @Override boolean subscribe(final ActorRef subscriber,
            final Set<String> topics,
            final Predicate<Collection<String>> filter); @Override boolean unsubscribe(final ActorRef subscriber, final Set<String> topics); @Override boolean removeSubscriber(final ActorRef subscriber); @Override boolean contains(final ActorRef subscriber); @Override int countTopics(); @Override SubscriptionsReader snapshot(); @Override boolean equals(final Object other); @Override int hashCode();  }
@Test public void testVennDiagramMembership() { final AbstractSubscriptions<H, T> underTest = getVennDiagram(); final SubscriptionsReader reader = underTest.snapshot(); assertThat(reader.getSubscribers(singleton("1"))).containsExactlyInAnyOrder(ACTOR1); assertThat(reader.getSubscribers(singleton("2"))).containsExactlyInAnyOrder(ACTOR1, ACTOR2); assertThat(reader.getSubscribers(singleton("3"))).containsExactlyInAnyOrder(ACTOR2); assertThat(reader.getSubscribers(singleton("4"))).containsExactlyInAnyOrder(ACTOR1, ACTOR3); assertThat(reader.getSubscribers(singleton("5"))).containsExactlyInAnyOrder(ACTOR1, ACTOR2, ACTOR3); assertThat(reader.getSubscribers(singleton("6"))).containsExactlyInAnyOrder(ACTOR2, ACTOR3); assertThat(reader.getSubscribers(singleton("7"))).containsExactlyInAnyOrder(ACTOR3); assertThat(underTest.subscriberToTopic.size()).isEqualTo(3); assertThat(underTest.topicToData.size()).isEqualTo(7); }
@Test public void testSnapshot() { final AbstractSubscriptions<H, T> underTest = getVennDiagram(); final SubscriptionsReader snapshot = underTest.snapshot(); assertThat(snapshot.getSubscribers(Arrays.asList("1", "2", "3"))).containsExactlyInAnyOrder(ACTOR1, ACTOR2); underTest.subscribe(ACTOR1, singleton("8")); underTest.unsubscribe(ACTOR1, singleton("1")); underTest.removeSubscriber(ACTOR2); assertThat(underTest.subscriberToTopic.size()).isEqualTo(2); assertThat(underTest.topicToData.size()).isEqualTo(6); assertThat(snapshot).isEqualTo(getVennDiagram().snapshot()); assertThat(snapshot).isNotEqualTo(underTest.snapshot()); }