DefaultSyncHandler implements SyncHandler { @Override public boolean requiresSync(@NotNull SyncedIdentity identity) { if (identity.getExternalIdRef() == null || identity.lastSynced() < 0) { return true; } final long now = System.currentTimeMillis(); final long expirationTime = identity.isGroup() ? config.group().getExpirationTime() : config.user().getExpirationTime(); return now - identity.lastSynced() > expirationTime; } @SuppressWarnings("UnusedDeclaration")  DefaultSyncHandler();  DefaultSyncHandler(DefaultSyncConfig config); @NotNull @Override String getName(); @NotNull @Override SyncContext createContext(@NotNull ExternalIdentityProvider idp, @NotNull UserManager userManager,
                                     @NotNull ValueFactory valueFactory); @Override SyncedIdentity findIdentity(@NotNull UserManager userManager, @NotNull String id); @Override boolean requiresSync(@NotNull SyncedIdentity identity); @NotNull @Override Iterator<SyncedIdentity> listIdentities(@NotNull UserManager userManager);  }
@Test public void testRequiresSyncMissingExternalIDRef() { assertTrue(syncHandler.requiresSync(new DefaultSyncedIdentity(USER_ID, null, false, Long.MAX_VALUE))); }
@Test public void testRequiresSyncNotYetSynced() throws Exception { assertTrue(syncHandler.requiresSync(new DefaultSyncedIdentity(USER_ID, idp.getUser(USER_ID).getExternalId(), false, Long.MIN_VALUE))); }