CassandraDeletedMessageDAO { public Flux<MessageUid> retrieveDeletedMessage(CassandraId cassandraId, MessageRange range) { return retrieveResultSetOfDeletedMessage(cassandraId, range) .flatMapMany(this::resultSetToFlux); } @Inject  CassandraDeletedMessageDAO(Session session, CassandraUtils cassandraUtils); @VisibleForTesting  CassandraDeletedMessageDAO(Session session); Mono<Void> addDeleted(CassandraId cassandraId, MessageUid uid); Mono<Void> removeDeleted(CassandraId cassandraId, MessageUid uid); Mono<Void> removeAll(CassandraId cassandraId); Flux<MessageUid> retrieveDeletedMessage(CassandraId cassandraId, MessageRange range);  }
@Test void retrieveDeletedMessageShouldReturnEmptyByDefault() { List<MessageUid> result = testee .retrieveDeletedMessage(MAILBOX_ID, MessageRange.all()) .collectList() .block(); assertThat(result).isEmpty(); }
@Test void retrieveDeletedMessageShouldReturnAllMessageForMessageRangeAll() { addMessageForRetrieveTest(); List<MessageUid> result = testee .retrieveDeletedMessage(MAILBOX_ID, MessageRange.all()) .collectList() .block(); assertThat(result).containsExactly(UID_1, UID_2, UID_3, UID_4, UID_7, UID_8); }
@Test void retrieveDeletedMessageShouldReturnOneMessageForMessageRangeOneIfThisMessageIsPresent() { addMessageForRetrieveTest(); List<MessageUid> result = testee .retrieveDeletedMessage(MAILBOX_ID, MessageRange.one(UID_1)) .collectList() .block(); assertThat(result).containsExactly(UID_1); }
@Test void retrieveDeletedMessageShouldReturnNoMessageForMessageRangeOneIfThisMessageIsNotPresent() { addMessageForRetrieveTest(); List<MessageUid> result = testee .retrieveDeletedMessage(MAILBOX_ID, MessageRange.one(MessageUid.of(42))) .collectList() .block(); assertThat(result).isEmpty(); }
@Test void retrieveDeletedMessageShouldReturnMessageInRangeForMessageRangeRange() { addMessageForRetrieveTest(); List<MessageUid> result = testee .retrieveDeletedMessage(MAILBOX_ID, MessageRange.range(MessageUid.of(3), MessageUid.of(7))) .collectList() .block(); assertThat(result).containsExactly(UID_3, UID_4, UID_7); }
@Test void retrieveDeletedMessageShouldReturnNoMessageForMessageRangeRangeIfNoDeletedMessageInThatRange() { addMessageForRetrieveTest(); List<MessageUid> result = testee .retrieveDeletedMessage(MAILBOX_ID, MessageRange.range(MessageUid.of(5), MessageUid.of(6))) .collectList() .block(); assertThat(result).isEmpty(); }
@Test void retrieveDeletedMessageShouldReturnNoMessageForMessageRangeFromIfNoDeletedMessageWithIdBiggerOrSameThanFrom() { addMessageForRetrieveTest(); List<MessageUid> result = testee .retrieveDeletedMessage(MAILBOX_ID, MessageRange.from(MessageUid.of(9))) .collectList() .block(); assertThat(result).isEmpty(); }
@Test void retrieveDeletedMessageShouldReturnDeletedMessageWithIdBiggerOrSameThanFrom() { addMessageForRetrieveTest(); List<MessageUid> result = testee .retrieveDeletedMessage(MAILBOX_ID, MessageRange.from(MessageUid.of(4))) .collectList() .block(); assertThat(result).containsExactly(UID_4, UID_7, UID_8); }