@SuppressLint("Assert") @SuppressWarnings("ConstantConditions") @Test public void testThatRuleAllowsPromptIfWarmUpPeriodHasPassed() { final int warmUpTimeDays = 7; final int daysSinceLastEvent = 9; assert daysSinceLastEvent > warmUpTimeDays; final WarmupDaysRule warmupDaysRule = new WarmupDaysRule(warmUpTimeDays); final long lastEventTime = SystemTimeUtil.currentTimeMillis() - TimeUnit.DAYS.toMillis(daysSinceLastEvent); final boolean ruleShouldAllowFeedbackPrompt = warmupDaysRule.shouldAllowFeedbackPrompt(lastEventTime); assertTrue( "Feedback prompt should be allowed if the warm-up period has passed", ruleShouldAllowFeedbackPrompt); }
@Override public boolean shouldAllowFeedbackPrompt(@NonNull final Long cachedEventValue) { return SystemTimeUtil.currentTimeMillis() - cachedEventValue > DAYS.toMillis(warmupPeriodDays); }
WarmupDaysRule implements IEventBasedRule<Long> { @Override public boolean shouldAllowFeedbackPrompt(@NonNull final Long cachedEventValue) { return SystemTimeUtil.currentTimeMillis() - cachedEventValue > DAYS.toMillis(warmupPeriodDays); } }
WarmupDaysRule implements IEventBasedRule<Long> { @Override public boolean shouldAllowFeedbackPrompt(@NonNull final Long cachedEventValue) { return SystemTimeUtil.currentTimeMillis() - cachedEventValue > DAYS.toMillis(warmupPeriodDays); } WarmupDaysRule(final long warmupPeriodDays); }
WarmupDaysRule implements IEventBasedRule<Long> { @Override public boolean shouldAllowFeedbackPrompt(@NonNull final Long cachedEventValue) { return SystemTimeUtil.currentTimeMillis() - cachedEventValue > DAYS.toMillis(warmupPeriodDays); } WarmupDaysRule(final long warmupPeriodDays); @Override boolean shouldAllowFeedbackPromptByDefault(); @Override boolean shouldAllowFeedbackPrompt(@NonNull final Long cachedEventValue); @NonNull @Override String getDescription(); }
WarmupDaysRule implements IEventBasedRule<Long> { @Override public boolean shouldAllowFeedbackPrompt(@NonNull final Long cachedEventValue) { return SystemTimeUtil.currentTimeMillis() - cachedEventValue > DAYS.toMillis(warmupPeriodDays); } WarmupDaysRule(final long warmupPeriodDays); @Override boolean shouldAllowFeedbackPromptByDefault(); @Override boolean shouldAllowFeedbackPrompt(@NonNull final Long cachedEventValue); @NonNull @Override String getDescription();  }