Skip to content

Commit

Permalink
Issue #908: added fromNullable to SpecBuilder (#909)
Browse files Browse the repository at this point in the history
* #908: added fromNullable to FluentSubscriptionRequest

* #908: #908: added fromNullable to FluentSubscriptionRequest
  • Loading branch information
uweschaefer committed Jun 30, 2020
1 parent ae2631e commit 671f9b6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Expand Up @@ -92,6 +92,11 @@ public SubscriptionRequest from(@NonNull UUID id) {
return toBuild;
}

public SubscriptionRequest fromNullable(UUID id) {
toBuild.startingAfter = id;
return toBuild;
}

public SpecBuilder follow(FactSpec specification) {
or(specification);
toBuild.continuous = true;
Expand Down
Expand Up @@ -27,6 +27,8 @@ public interface SpecBuilder {

SubscriptionRequest from(@NonNull UUID id);

SubscriptionRequest fromNullable(UUID id);

SubscriptionRequest fromScratch();

SubscriptionRequest fromNowOn();
Expand Down
Expand Up @@ -40,6 +40,12 @@ void testFollowNull() {
(FactSpec) null));
}

@Test
void testFollowNullable() {
SubscriptionRequest req = SubscriptionRequest.follow(FactSpec.ns("foo")).fromNullable(null);
assertFalse(req.startingAfter().isPresent());
}

@Test
void testCatchupNull() {
Assertions.assertThrows(NullPointerException.class, () -> SubscriptionRequest.catchup(
Expand Down

0 comments on commit 671f9b6

Please sign in to comment.