@Test public void saveSubscription() { final InMemoryDataStore store = new InMemoryDataStore(); final Subscription subscription = mockSubscription(UUID.randomUUID().toString(), "p123"); store.saveSubscription(subscription); final Optional<Subscription> optionalSub = store.subscription(subscription.id()); assertThat(optionalSub.isPresent(), is(true)); assertThat(optionalSub.get().id(), equalTo(subscription.id())); assertThat(optionalSub.get().pushResourceId(), equalTo(subscription.pushResourceId())); }
@Override public void saveSubscription(final Subscription subscription) { Objects.requireNonNull(subscription, "subscription must not be null"); subscriptions.putIfAbsent(subscription.id(), subscription); }
InMemoryDataStore implements DataStore { @Override public void saveSubscription(final Subscription subscription) { Objects.requireNonNull(subscription, "subscription must not be null"); subscriptions.putIfAbsent(subscription.id(), subscription); } }
InMemoryDataStore implements DataStore { @Override public void saveSubscription(final Subscription subscription) { Objects.requireNonNull(subscription, "subscription must not be null"); subscriptions.putIfAbsent(subscription.id(), subscription); }  }
InMemoryDataStore implements DataStore { @Override public void saveSubscription(final Subscription subscription) { Objects.requireNonNull(subscription, "subscription must not be null"); subscriptions.putIfAbsent(subscription.id(), subscription); }  @Override void saveSubscription(final Subscription subscription); @Override Optional<Subscription> subscription(final String id); @Override List<PushMessage> removeSubscription(final String id); @Override void saveMessage(final PushMessage msg); @Override List<PushMessage> waitingDeliveryMessages(final String subId); @Override void saveSentMessage(final PushMessage msg); @Override Optional<PushMessage> sentMessage(final String subId, final String msgId); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); }
InMemoryDataStore implements DataStore { @Override public void saveSubscription(final Subscription subscription) { Objects.requireNonNull(subscription, "subscription must not be null"); subscriptions.putIfAbsent(subscription.id(), subscription); }  @Override void saveSubscription(final Subscription subscription); @Override Optional<Subscription> subscription(final String id); @Override List<PushMessage> removeSubscription(final String id); @Override void saveMessage(final PushMessage msg); @Override List<PushMessage> waitingDeliveryMessages(final String subId); @Override void saveSentMessage(final PushMessage msg); @Override Optional<PushMessage> sentMessage(final String subId, final String msgId); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); static final byte[] EMPTY_BYTES; }