@Test public void testSetUnseenState() throws Exception { ImmutableList.Builder<Notification> builder = ImmutableList.builder(); for (int i = 1; i < 11; i++) { builder.add(Notification.create(String.format("%02d", i))); } final List<Notification> notifications = builder.build(); builder = ImmutableList.builder(); for (int i = 1; i < 11; i++) { builder.add(Notification.builder().withId(String.format("%02d", i)).withUnseen(true).build()); } final List<Notification> expectedUnseen = builder.build(); builder = ImmutableList.builder(); for (int i = 1; i < 11; i++) { builder.add( Notification.builder().withId(String.format("%02d", i)).withUnseen(false).build()); } final List<Notification> expectedSeen = builder.build(); assertThat(NotificationStore.setUnseenState(notifications, true).iterator()) .containsExactlyElementsOf(expectedUnseen); assertThat(NotificationStore.setUnseenState(notifications, false).iterator()) .containsExactlyElementsOf(expectedSeen); }
public static Stream<Notification> setUnseenState( final Iterable<Notification> notifications, final boolean unseen) { return StreamSupport.stream(notifications.spliterator(), false) .map(notification -> Notification.builder(notification).withUnseen(unseen).build()); }
NotificationStore { public static Stream<Notification> setUnseenState( final Iterable<Notification> notifications, final boolean unseen) { return StreamSupport.stream(notifications.spliterator(), false) .map(notification -> Notification.builder(notification).withUnseen(unseen).build()); } }
NotificationStore { public static Stream<Notification> setUnseenState( final Iterable<Notification> notifications, final boolean unseen) { return StreamSupport.stream(notifications.spliterator(), false) .map(notification -> Notification.builder(notification).withUnseen(unseen).build()); } NotificationStore(
      final RiakClient client,
      final IdGenerator idGenerator,
      final CursorStore cursors,
      final RuleStore ruleStore,
      final Duration timeout,
      final Duration requestTimeout); }
NotificationStore { public static Stream<Notification> setUnseenState( final Iterable<Notification> notifications, final boolean unseen) { return StreamSupport.stream(notifications.spliterator(), false) .map(notification -> Notification.builder(notification).withUnseen(unseen).build()); } NotificationStore(
      final RiakClient client,
      final IdGenerator idGenerator,
      final CursorStore cursors,
      final RuleStore ruleStore,
      final Duration timeout,
      final Duration requestTimeout); void initialize(); Optional<UserNotifications> fetch(final String username); UserNotifications splitNotifications(
      final String username, @Nullable final SortedSet<Notification> notifications); Notification store(final String username, final Notification notification); void removeAll(final String username); void remove(final String username, final Collection<String> ids); static Stream<Notification> setUnseenState(
      final Iterable<Notification> notifications, final boolean unseen); static Optional<Notification> tryFind(
      final Iterable<Notification> notifications, final String id); static int indexOf(final Iterable<Notification> notifications, final String id); Iterable<Notification> skip(
      final Iterable<Notification> notifications,
      final String startId,
      final boolean inclusive,
      final int limitSize); }
NotificationStore { public static Stream<Notification> setUnseenState( final Iterable<Notification> notifications, final boolean unseen) { return StreamSupport.stream(notifications.spliterator(), false) .map(notification -> Notification.builder(notification).withUnseen(unseen).build()); } NotificationStore(
      final RiakClient client,
      final IdGenerator idGenerator,
      final CursorStore cursors,
      final RuleStore ruleStore,
      final Duration timeout,
      final Duration requestTimeout); void initialize(); Optional<UserNotifications> fetch(final String username); UserNotifications splitNotifications(
      final String username, @Nullable final SortedSet<Notification> notifications); Notification store(final String username, final Notification notification); void removeAll(final String username); void remove(final String username, final Collection<String> ids); static Stream<Notification> setUnseenState(
      final Iterable<Notification> notifications, final boolean unseen); static Optional<Notification> tryFind(
      final Iterable<Notification> notifications, final String id); static int indexOf(final Iterable<Notification> notifications, final String id); Iterable<Notification> skip(
      final Iterable<Notification> notifications,
      final String startId,
      final boolean inclusive,
      final int limitSize);  }