DistributedEventTracker implements EventTracker { @Override public boolean hasSeenEvent(InternalCacheEvent event) { EventID eventID = event.getEventId(); if (ignoreEvent(event, eventID)) { return false; } return hasSeenEvent(eventID, event); } DistributedEventTracker(InternalCache cache, CancelCriterion stopper, String regionName); @Override void start(); @Override void stop(); @Override void clear(); @Override Map<ThreadIdentifier, EventSequenceNumberHolder> getState(); @Override void recordState(InternalDistributedMember provider,
      Map<ThreadIdentifier, EventSequenceNumberHolder> state); @Override void setInitialized(); @Override void waitOnInitialization(); @Override void recordEvent(InternalCacheEvent event); @Override boolean hasSeenEvent(InternalCacheEvent event); @Override boolean hasSeenEvent(EventID eventID); @Override boolean hasSeenEvent(EventID eventID, InternalCacheEvent tagHolder); @Override VersionTag findVersionTagForSequence(EventID eventID); @Override VersionTag findVersionTagForBulkOp(EventID eventID); @Override String getName(); @Override void syncBulkOp(Runnable r, EventID eventID, boolean partOfTransaction); @Override void recordBulkOpStart(EventID eventID, ThreadIdentifier tid); @Override boolean isInitialized(); @Override boolean isInitialImageProvider(DistributedMember mbr); @Override ConcurrentMap<ThreadIdentifier, BulkOperationHolder> getRecordedBulkOpVersionTags(); @Override ConcurrentMap<ThreadIdentifier, EventSequenceNumberHolder> getRecordedEvents(); @Override String toString();  }
@Test public void hasSeenEventReturnsFalseForEventWithNoID() { InternalCacheEvent event = mock(InternalCacheEvent.class); when(event.getEventId()).thenReturn(null); assertFalse(eventTracker.hasSeenEvent(event)); }
@Test public void hasSeenEventReturnsFalseForNullEventID() { assertFalse(eventTracker.hasSeenEvent((EventID) null)); assertFalse(eventTracker.hasSeenEvent(null, null)); }
@Test public void hasNotSeenEventIDThatIsNotInRecordedEvents() { EventID eventID = new EventID(new byte[0], 0L, 0L); assertFalse(eventTracker.hasSeenEvent(eventID)); }
@Test public void hasSeenEventIDThatIsInRecordedEvents() { EventID eventID = new EventID(new byte[0], 0L, 0L); recordSequence(eventID); assertTrue(eventTracker.hasSeenEvent(eventID)); }
@Test public void hasNotSeeEventIDWhosSequenceIDIsLargerThanSeen() { EventID eventID = new EventID(new byte[0], 0L, 0L); recordSequence(eventID); EventID higherSequenceID = new EventID(new byte[0], 0L, 1); assertFalse(eventTracker.hasSeenEvent(higherSequenceID)); }