DefaultLongPollingManager implements LongPollingManager { @Override public ZonedDateTime getLastTimeStamp(AbstractDto dto) { ZonedDateTime lastModified = dto.getModified(); if (lastModified == null) { lastModified = dto.getCreated(); } if (lastModified == null) { return null; } if (dto.getCreated() != null && lastModified.isBefore(dto.getCreated())) { lastModified = dto.getCreated(); } return lastModified.plus(1, ChronoUnit.MILLIS); }  @Override void checkDeferredRequests(Class<? extends AbstractDto> type); @Override synchronized void addSuspendedResult(DeferredResultWrapper result); @SuppressWarnings({ "unchecked", "rawtypes" }) @Override void baseCheckDeferredResult(DeferredResult<OperationResultDto> deferredResult,
			LongPollingSubscriber subscriber, ModifiedFromFilter filter,
			ReadDtoService service, boolean checkCount); @Scheduled(fixedDelay = 7200000) // Every two hours void clearUnUseSubscribers(); @Override void clearUnUseSubscribers(ZonedDateTime clearBeforIt); @Override boolean isLongPollingEnabled(); @Override ZonedDateTime getLastTimeStamp(AbstractDto dto); Queue<DeferredResultWrapper> getSuspendedRequests(); Map<UUID, LongPollingSubscriber> getRegistredSubscribers();  }
@Test public void testGetLastTimeStamp() { IdmIdentityDto identityOne = new IdmIdentityDto(); identityOne.setCreated(ZonedDateTime.now().minusMinutes(10)); identityOne.setModified(ZonedDateTime.now().minusMinutes(100)); ZonedDateTime lastTimeStamp = longPollingManager.getLastTimeStamp(identityOne); assertEquals(identityOne.getCreated().plus(1, ChronoUnit.MILLIS), lastTimeStamp); identityOne.setCreated(ZonedDateTime.now().minusMinutes(100)); identityOne.setModified(ZonedDateTime.now().minusMinutes(10)); lastTimeStamp = longPollingManager.getLastTimeStamp(identityOne); assertEquals(identityOne.getModified().plus(1, ChronoUnit.MILLIS), lastTimeStamp); identityOne.setCreated(ZonedDateTime.now().minusMinutes(100)); identityOne.setModified(null); lastTimeStamp = longPollingManager.getLastTimeStamp(identityOne); assertEquals(identityOne.getCreated().plus(1, ChronoUnit.MILLIS), lastTimeStamp); identityOne.setCreated(null); identityOne.setModified(ZonedDateTime.now().minusMinutes(100)); lastTimeStamp = longPollingManager.getLastTimeStamp(identityOne); assertEquals(identityOne.getModified().plus(1, ChronoUnit.MILLIS), lastTimeStamp); }