@Test @DisplayName("detect that the entity state stopped matching the subscription criteria") void tellNoLongerMatching() { ProjectId targetId = projectId(TARGET_ID); String targetName = "previously-matching-project"; SubscriptionRecord record = projectRecord(targetId, Filters.eq("name", targetName)); Project matching = projectWithName(targetName); Project nonMatching = projectWithName("not-matching-anymore"); EventEnvelope envelope = stateChangedEnvelope(targetId, matching, nonMatching); Optional<SubscriptionUpdate> maybeUpdate = record.detectUpdate(envelope); assertThat(maybeUpdate).isPresent(); EntityStateUpdate entityUpdate = firstEntityUpdate(maybeUpdate); assertTrue(entityUpdate.getNoLongerMatching()); }
@VisibleForTesting Optional<SubscriptionUpdate> detectUpdate(EventEnvelope event) { return handler.detectUpdate(event); }
SubscriptionRecord { @VisibleForTesting Optional<SubscriptionUpdate> detectUpdate(EventEnvelope event) { return handler.detectUpdate(event); } }
SubscriptionRecord { @VisibleForTesting Optional<SubscriptionUpdate> detectUpdate(EventEnvelope event) { return handler.detectUpdate(event); } private  SubscriptionRecord(Subscription s, TypeUrl targetType, UpdateHandler handler); }
SubscriptionRecord { @VisibleForTesting Optional<SubscriptionUpdate> detectUpdate(EventEnvelope event) { return handler.detectUpdate(event); } private  SubscriptionRecord(Subscription s, TypeUrl targetType, UpdateHandler handler); @Override boolean equals(Object o); @Override int hashCode(); }
SubscriptionRecord { @VisibleForTesting Optional<SubscriptionUpdate> detectUpdate(EventEnvelope event) { return handler.detectUpdate(event); } private  SubscriptionRecord(Subscription s, TypeUrl targetType, UpdateHandler handler); @Override boolean equals(Object o); @Override int hashCode();  }