@Test public void shouldGetReturnEmptyOptionalWhenNotPresent() throws Exception { final String expectedValueKey = UUID.randomUUID().toString(); setBeforeTransactionAssertion(connection -> { assertions.assertThat(connection.exists(expectedValueKey.getBytes())).isFalse(); }); Optional<EmailSchedulingData> givenOptionalEmailSchedulingData = defaultPersistenceService.get(expectedValueKey); assertions.assertThat(givenOptionalEmailSchedulingData) .isEmpty(); }
@Override public Optional<EmailSchedulingData> get(@NonNull final String id) { return Optional.ofNullable(getOps(id)); }
DefaultPersistenceService implements PersistenceService { @Override public Optional<EmailSchedulingData> get(@NonNull final String id) { return Optional.ofNullable(getOps(id)); } }
DefaultPersistenceService implements PersistenceService { @Override public Optional<EmailSchedulingData> get(@NonNull final String id) { return Optional.ofNullable(getOps(id)); } @Autowired  DefaultPersistenceService(@Qualifier("orderingTemplate") @NonNull final StringRedisTemplate orderingTemplate,
                                     @Qualifier("valueTemplate") @NonNull final RedisTemplate<String, EmailSchedulingData> valueTemplate); }
DefaultPersistenceService implements PersistenceService { @Override public Optional<EmailSchedulingData> get(@NonNull final String id) { return Optional.ofNullable(getOps(id)); } @Autowired  DefaultPersistenceService(@Qualifier("orderingTemplate") @NonNull final StringRedisTemplate orderingTemplate,
                                     @Qualifier("valueTemplate") @NonNull final RedisTemplate<String, EmailSchedulingData> valueTemplate); @Override void add(@NonNull final EmailSchedulingData emailSchedulingData); @Override Optional<EmailSchedulingData> get(@NonNull final String id); @Override boolean remove(@NonNull final String id); @Override void addAll(@NonNull final Collection<EmailSchedulingData> emailSchedulingDataList); @Override Collection<EmailSchedulingData> getNextBatch(final int priorityLevel, final int batchMaxSize); @Override Collection<EmailSchedulingData> getNextBatch(final int batchMaxSize); @Override void removeAll(); @Override void removeAll(final int priorityLevel); @Override void removeAll(@NonNull final Collection<String> ids); }
DefaultPersistenceService implements PersistenceService { @Override public Optional<EmailSchedulingData> get(@NonNull final String id) { return Optional.ofNullable(getOps(id)); } @Autowired  DefaultPersistenceService(@Qualifier("orderingTemplate") @NonNull final StringRedisTemplate orderingTemplate,
                                     @Qualifier("valueTemplate") @NonNull final RedisTemplate<String, EmailSchedulingData> valueTemplate); @Override void add(@NonNull final EmailSchedulingData emailSchedulingData); @Override Optional<EmailSchedulingData> get(@NonNull final String id); @Override boolean remove(@NonNull final String id); @Override void addAll(@NonNull final Collection<EmailSchedulingData> emailSchedulingDataList); @Override Collection<EmailSchedulingData> getNextBatch(final int priorityLevel, final int batchMaxSize); @Override Collection<EmailSchedulingData> getNextBatch(final int batchMaxSize); @Override void removeAll(); @Override void removeAll(final int priorityLevel); @Override void removeAll(@NonNull final Collection<String> ids);  }